2009年7月23日星期四

Grails on Google App Engine



Grails on Google App Engine


1. Download

2. Install
  • 设置系统环境变量:
    GROOVY_HOME
    GRAILS_HOME
    Path: %GROOVY_HOME%\bin;%GRAILS_HOME%\bin

3.Create App
  • 创建应用
    grails create-app hook-hub

  • 更改配置
    renli-resource/grails-app/conf/Config.groovy中添加如下行:
    google.appengine.application="hook-hub"

  • 安装AppEngine plugin
    cd hook-hub
    grails uninstall-plugin hibernate
    grails install-plugin app-engine

  • 运行AppEngine
    grails create-domain-class com.vickcy.Book
    grails install-plugin hibernate
    grails generate-all com.vickcy.Book
    grails uninstall-plugin hibernate

  • Delete : target/war/WEB-INF/datastore-indexes.xml

  • 运行AppEngine
    grails app-engine run

  • 向GAE部署应用
    grails set-version 1

    grails app-engine package

    %APPENGINE_HOME%/bin/appcfg.cmd update target/war
    * 部署时应用名必须与注册的GAE应用名一致


4.Develop Environment

 

  • Eclipse3.4 plugin
    Google App Engine plugin
        - update site: http://dl.google.com/eclipse/plugin/3.4

    TestNG plugin - Groovy plugin 的前提
        - update site: http://beust.com/eclipse

    Groovy plugin
        - update site: http://dist.groovy.codehaus.org/distributions/update/

 

 

  • Eclipse Project Setting
    Project -> Properties -> Java Build Path -> Libraries -> Edit ->Variable -> New
        Name: GRAILS_HOME
        Path: Grails根目录

 


















6 条评论:

  1. 謝謝你這篇介紹。
    請問,我跟著你的步驟可以成功
    grails create-domain-class com.vickcy.Book
    grails install-plugin hibernate
    grails generate-all com.vickcy.Book
    grails uninstall-plugin hibernate

    可是接著我想再creade一個domain卻不能成功連到新的
    grails create-domain-class Game
    grails install-plugin hibernate
    grails generate-all Game
    grails uninstall-plugin hibernate

    我就連不到Game,會有此error
    Error 500: javax.jdo.JDOFatalUserException: No meta data for Game. Perhaps you need to run the enhancer on this class? NestedThrowables: org.datanucleus.exceptions.NucleusUserException: No meta data for Game. Perhaps you need to run the enhancer on this class?
    Servlet: grails
    URI: /grails/game/list.dispatch
    Exception Message: No meta data for Game. Perhaps you need to run the enhancer on this class?
    Caused by: javax.jdo.JDOFatalUserException: No meta data for Game. Perhaps you need to run the enhancer on this class? NestedThrowables: org.datanucleus.exceptions.NucleusUserException: No meta data for Game. Perhaps you need to run the enhancer on this class?
    Class: GameController
    At Line: [14]

    請問你遇過這問題嗎?thanks

    回复删除
  2. 此评论已被作者删除。

    回复删除
  3. sorry, 後來試又可以了。不知道是不是瀏覽器有什麼cache住,我按ctrl+F5 reload後就ok

    回复删除