Doing a grails app release with maven

Release process of a grails app

Performing a grails app release with maven is slightly different from doing a standard release from standard java apps/libs.

The problem exists because at some points the grails application.version from the application.properties does not coincide with the version on your pom.xml.

Have a clean project

As usual, commit all your files. And clean the project.
I use to "svn co" the project into a tmp dir so I'm sure that I'm only working with the code that's going to be released.

Test if the project is ready to be released

mvn release:prepare -DdryRun=true

This will run the release:prepare goal but without committing nothing to the SCM. At the end you can verify you did everything correctly by checking the state of the updated pom.xml.

Increase the application.version

You should increase your application's version before performing the real release:prepare so that it does not collide with the artifact version on the pom. So if you're at 0.0.1-SNAPSHOT your release version will be 0.0.1. To set and commit this:

$ mvn grails:exec -Dcommand=set-version -Dargs=0.0.1
$ svn ci -m "Prepare release 0.0.1."  application.properties

Perform the real release:prepare

$ mvn release:clean release:prepare -Dusername=name_of_the_user -Dpassword=passwd

Here username and password are optionals depending on your scm configuration.

Snapshot the application.version

Again your application.version and the artifact's version in your pom.xml will be different and this should be corrected:

$ mvn grails:exec -Dcommand=set-version -Dargs=0.0.2-SNAPSHOT
$ svn ci -m "Set application.version=0.0.2-SNAPSHOT after release." application.properties

Go for the next release

Prepare a sprint and go!

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License