mvn org.apache.maven.plugins:maven-archetype-plugin:2.0-alpha-4:generate \
-DarchetypeGroupId=org.grails \
-DarchetypeArtifactId=grails-maven-archetype \
-DarchetypeVersion=1.1 \
-DgroupId=com.black -DartifactId=grails-project
With that, here is what works so far:
General sequence (these are also the steps for keeping a development team in synch):
svn up
grails upgrade --non-interactive
mvn clean install -DnonInteractive=true
Notes:
- Step 2 above: This upgrades the grails project to include all core grails plugins and also creates some important files under web-app/WEB-INF (applicationContext.xml, ...). We would rather run
mvn grails:exec -Dcommand=upgrade -DnonInteractive
, however, this fails with an error:Embedded error: java.lang.reflect.InvocationTargetException
Anybody have an idea on this?
/home/black/dev/branches/parent/grails-project/null/src/war not found. - Step 3 above: This step will upgrade all non-core plugins added/modified/removed since the last checkout. Since grails will ask the "are you sure" question, make sure in CI to add the non-interactive switch as above, which will have the effect of cheerfully answering "Y" to all of grails questions.
Problems you may run into:
- As part of a big maven multiproject build, grails may consume enough memory to produce an out of memory error.
- Fix: Set
MAVEN_OPTS=-Xmx512m -XX:MaxPermSize=150m
- Fix: Set
- Adding new grails plugins to the build will freeze the CI build due to the "are you sure" prompt. The same will happen when removing a grails plugin.
- Fix: Add the non-interactive switch to the build (
mvn -DnonInteractive=true
orgrails --non-interactive
)
- Fix: Add the non-interactive switch to the build (
- Webtest launches a window during the test run that needs a display, so CI may need to run the webtests headless.
- Fix: Add non-interactive switch to the build (
mvn -DnonInteractive=true
orgrails --non-interactive
)
- Fix: Add non-interactive switch to the build (
- Webtest starts the jetty server on port 8080 by default which may clash with other services on your CI box using that port.
- Fix: Use the switch
mvn -Dserver.port=8183
. Note: The webtest.properties file property
seems to be used if the code under test were already hosted on another running server besides the provided jetty.wt.config.port
- Fix: Use the switch
- A maven multiproject build that includes a grails project with webtests will look for
/test/webtest/conf/webtest.properties
in the wrong directory. That is, it will not look in ${basedir}, but always in the root project where you invoked maven to start with.- Workaround: Create a hudson job that only builds the grails war/webtest project. Create a downstream dependency on your main CI hudson job to trigger this one to build.
- Fix: ?? Anyone have an answer for this one?
I hope this helps. For the few items above that have lingering questions, I would be interested in hearing if you have solved these. Let me know.