2009年8月2日

Grails on Google App Engine傻瓜包

1. 準備工作2. 環境變數
export GRAILS_HOME="/home/lundi/Java/grails-1.1.1"
PATH="$PATH:$GRAILS_HOME/bin"
export JAVA_HOME="/usr/lib/jvm/java-6-sun"
export APPENGINE_HOME="/home/lundi/Java/appengine-java-sdk-1.2.2"

3. 建立google app
  • grails create-app lundi326
如果後面跟google App Engine的app不同,則要在grails-app/conf/Config.groovy修改
google.appengine.application="app-name"
  • 安裝Grails AppEngine plugin及Grails web application
cd lundi326
grails uninstall-plugin hibernate
grails install-plugin app-engine
grails create-domain-class lundi.Game
grails install-plugin hibernate
grails generate-all lundi.Game
grails uninstall-plugin hibernate
grails app-engine run


4. 上傳到google App Engine
grails set-version 1
grails app-engine package
$APPENGINE_HOME/bin/appcfg.sh update target/war


過程中,我浪費不少時間,因為之前我都用grails create-domain-class Game,都會失敗,後來改grails create-domain-class lundi.Game,才可以,好像一定要有package,或許是google App Engine規定的吧。

完成。 http://lundi326.appspot.com/

參考:
Grails on Google App Engine
Grails AppEngine plugin 裏面的介紹也很不錯
張貼留言