2009年8月7日

Grails/GAE project in Eclipse

雖然對Grails支援最好的IDE應該是IntelliJ,可是用習慣Eclipse的我,還是選擇Eclipse。

要在Eclipse上跑Grails,前置作業可以參考我另一篇"Grails on Google App Engine傻瓜包",先建一個project。
然後在Eclipse上import project:
File -> import... -> General -> Existing Projects into Workspace

然後我有遇到兩個error,這邊是我的作法。

1. jdo:
會看到這樣的error
unable to resolve class Persistent , unable to find class for annotation
這是因為它會看不懂這些
@PersistenceCapable
@PrimaryKey

我是把project下的target/war/WEB-INF/lib/jdo2-api-2.3-ea.jar加到build path,來解決這問題。

2. spring
conf/spring目錄會看到紅色error,error敘述如下:
Invalid Package declaration in script: xxxx\grails-app\conf\spring\resources.groovy is not in a source folder matching the package declaration: train/grails-app/conf/spring resources.groovy line 0

這個只要把conf/spring加入source path就ok了,否則Eclipse會將他當作package。


沒有留言: