8/27/2014 - 6:47 AM



We have started doing proper versioned releases for the components we where focussing on last week (biocache-store, biocache-service, collectory), but I think we need to start this for all components. One problem with this is Grails. For Java maven projects, versioning is very easy. There is a maven release plugin [1] that does the following when a user runs mvn release:perform:

  1. Changes the version number in the pom.xml from for example 1.2-SNAPSHOT to 1.2 and commits the pom.xml
  2. Creates a tag for this version 1.2
  3. Performs a mvn deploy which builds the projects and puts artefacts in our maven repo [2]
  4. Changes the version number in the pom.xml from for example 1.3-SNAPSHOT and commits the pom.xml

This is all done in a fairly atomic fashion and can be rolled back. So what we need is the same capability but for Grails. The only difference between the Grails version and the Java version is the file that needs to be manipulated (Grails: application.propertes, Java: pom.xml). We are currently doing the above for Grails manually but this is error prone.

[1] http://maven.apache.org/maven-release/maven-release-plugin

[2] http://maven.ala.org.au/repository/au/org/ala/biocache-store/1.2

# TODO: review this - and suggest some reasonable branching strategy if required/suitable

# we are currently at version: 1.2-SNAPSHOT

# get the grails module source
git clone ala-module-in-grails
cd ala-module-in-grails

# preview what is about to happen
mvn release:prepare -DdryRun=true

# bump from 1.2-SNAPSHOT to version: 1.2
mvn grails:exec -Dcommand=set-version -Dargs=1.2

# commit it
git commit application.properties -m "release1.2"

# tag it
git tag -a v1.2 -m 'release1.2'

# push the source changes: application.properties
git push

# push the tag (this will make it appear on github in the release-s) 
git push origin v1.2 # or: git push origin --tags

# make the release
mvn release:clean release:prepare

# post release step, adjust application.properties to 1.3-SNAPSHOT
mvn grails:exec -Dcommand=set-version -Dargs=1.3-SNAPSHOT
git commit application.properties -m "start of 1.3-SNAPSHOT"
git push