如果還沒有安裝IDEA或者JetGroovy插件,請看我上一篇《安裝IntelliJ IDEA JetGroovy》
http://wangcheng.iteye.com/blog/156885
?
1.下載Grails
http://grails.org/Download
下載grails-bin-1.0.1.zip后,解壓到硬盤。
你也可以安照其它文檔的介紹,配置環境變量等。
?
2.配置JetGroovy插件
File -> Settings -> IDE Settings -> Groovy&Grails
在Groovy的Groovy installation directory中設置Groovy的解壓縮目錄.
在Grails的Grails installation directory中設置Grails的解壓縮目錄.
?
3.創建一個Grails項目
File -> New Project -> Create project from scratch
在Select type中選Grails Application
在Name中輸入一個項目名,比如myGrailsProject
然后一路next,IDEA就會為你創建好Grails項目結構
?
4.創建Controller
New -> Grails -> Grails Controller
輸入一個Controller的名字,比如 hello
然后就會打開一個HelloController.groovy的文件
輸入內容如下
//groovy code class HelloController { def index = { render "Hello World! my first Grails"; } }
?
5.配置Run Configurations
Run -> Edit Configurations
點右上角的 "+" (Add New Configurations)
選擇Grails Application
在Name中輸入一個名字
也可以在VM Parameters中寫參數,比如修改port等
6.啟動
直接Run就運行了。
啟動后會提示
Server running. Browse to
http://localhost:8090/myGrailsProject
訪問
http://localhost:8090/myGrailsProject
然后點擊HelloController 就可以看到輸出了。
?
?
參考
http://grails.org/IDEA+Integration
?
更多文章、技術交流、商務合作、聯系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
