Last updated by
3 years ago
Page: Developer - Maven Integration, Version:6
The Grails Maven integration consists of an archetype and a plugin.To update the archetype you need to specify a new archetype version in If the new archetype requires a new version of the Grails plugin this can be specified too:To test out archetype changes you should install the archetype locally with:And then once you are satisfied deploy the changes withDeployment can be done with:
The Maven archetype
The source for the archetype is located in Git. The archetype defines the project template when creating a Grails project with the command:mvn org.apache.maven.plugins:maven-archetype-plugin:2.0-alpha-4:generate
-DarchetypeGroupId=org.grails
-DarchetypeArtifactId=grails-maven-archetype
-DarchetypeVersion=1.0
-DgroupId=example -DartifactId=my-appARCHETYPE_HOME/pom.xml and specify the Grails version it relates to in src/main/resources/archetype-resources/pom.xml by updating the following two dependenices:<dependency>
<groupId>org.grails</groupId>
<artifactId>grails-crud</artifactId>
<version>1.1-RC2</version>
</dependency>
<dependency>
<groupId>org.grails</groupId>
<artifactId>grails-gorm</artifactId>
<version>1.1-RC2</version>
</dependency><plugins>
<plugin>
<groupId>org.grails</groupId>
<artifactId>grails-maven-plugin</artifactId>
<version>1.0-RC2</version>
...mvn install
mvn deploy
The Maven Plugin
The source for the Maven plugin is also in Git. A local version can be installed by doing:mvn install
mvn deploy
Testing
Because Maven caches the files it downloads, you have to be careful when testing that you aren't picking up artifacts from previous runs/builds. Before publishing a release, you must always try the Maven integration out with a clean cache. To do that, just follow these steps:- Remove everything under
~/.m2/repository/. - Install latest version of
grails-maven-archetypeby runningmvn installfrom your working copy. - Install latest version of
grails-maven-archetypeby runningmvn installfrom your working copy. - Install latest version of
grails-maven-pluginby runningmvn install. - Install latest version of Grails by running
ant maven-install.
pom.xml of the plugin ends with -SNAPSHOT then the plugin will be deployed to the Codehaus snapshot repository otherwise to the real one.