我用 root 登入主機
先裝了 git
#mkdir -p ~/workspace
#cd ~/workspace
#su -c 'yum install git-core'
再用 git去下載grails
#git clone git://github.com/grails/grails-core.git
可是
http://www.grails.org/Installation
上面寫說要設 GRAILS_HOME 與 PATH 環境變數? 怎麼設啊?
我用 SET GRAILS_HOME=~/workspace/grails-core
怎麼還是沒效?
用SET去看環境變數, 就是看不到GRAILS_HOME這個
那到底grails該怎麼安裝?
在RedHat系列的Linux, 環境變數的設定
(1)系統層次:在/etc/profile, ~/.profile, ~/.bash_login, /etc/profile.d/*.sh等處,
就直接編輯/etc/profile檔:
GRAILS_HOME=~/workspace/grails-core
export GRAILS_HOME
PATH=$GRAILS_HOME/bin:$PATH
export PATH
(2)程序層次:直接在安裝grails時用export設定:
$ export PATH=<GRAILS BIN>:$PATH
$ export GRAILS_HOME=<GRAILS HOME>
修改grails的啟動指令將上兩個指令加進去.
也需設定JAVA_HOME, CATALINA_HOME及其PATH的.
改過 /etc/profile 之後
會自動生效?
還是要重新開機?
./gradlew install
跑了約10分鐘
跑到
BUILD FAILED
這到底是我還有漏掉什麼步驟嗎?
請用這指令使修改生效:
$ source /etc/profile
我剛按照官網的步驟裝了一下, 沒有任何問題的:
....
:install
BUILD SUCCESSFUL
Total time: 8 mins 35.211 secs
我按照官網的hellowolrd執行也正常:
$ grails
| Enter a script name to run. Use TAB for completion:
grails> create-controller hello
| Created file grails-app/controllers/helloworld/HelloController.groovy
| Created file grails-app/views/hello
| Created file test/unit/helloworld/HelloControllerTests.groovy
grails> exit
| Goodbye
修改:
$ nano grails-app/controllers/helloworld/HelloController.groovy
改為:
$ cat grails-app/controllers/helloworld/HelloController.groovy
package helloworld
class HelloController {
def index() {
render "Hello World!"
}
}
然後執行:
$ grails
| Enter a script name to run. Use TAB for completion:
grails> run-app
| Server running. Browse to http://localhost:8080/helloworld
| Application loaded in interactive mode. Type 'stop-app' to shutdown.
| Enter a script name to run. Use TAB for completion:
就可以運作了:
http://192.168.1.102:8080/helloworld/hello/index
當然看到的是
Hello World!
Grails, Play!, 和RoR看來都很像. 而RoR也有JVM版的. 所以Java平台的發展越來越好了.
可是我裝到快腦死了
也分不清楚問題出在那裡
#./gradlew install
跑起來最後是這樣
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':grails-bootstrap:compileGroovy'.
Forked groovyc returned error code: 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
player提到:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
請試試:
$ ./gradlew install --stacktrace
看看少了什麼?
或
$ ./gradlew install --debug
來檢查log
雖然我最後還是裝不起來
不過還是謝了你的回答
工作的難度一下子跳太高
也許該做好最壞的打算了