Affichage des articles dont le libellé est appengine. Afficher tous les articles
Affichage des articles dont le libellé est appengine. Afficher tous les articles

mardi 19 juin 2012

Synchronize maven and gae application version

We are currently developing a maven project deployed on google appengine.Maven manages a version property in its pom.xml:
When we release the project with maven (mvn release:prepare and mvn release:perform), this version number gets automatically increased to the next development version, for example from 0.0.1-SNAPSHOT to 0.0.2-SNAPSHOT.
The main problem is that google app engine uses another version descriptor in the appengine-web.xml file that is independent from the first one:
It would be great to get those to versions number synchronized! Here is a solution how to get it working:
  • Define a tiny groovy script, let’s say utils.groovy, that will define a property defining the gae version. The problem is that we can’t use the maven version directly since gae does not accept ‘.’ and ‘-SNAPSHOT’ in it’s version. So this script will map the gae version to the maven version in that way:  X.Y.Z(-SNAPSHOT) -> X-Y-Z . Of course we will lose the SNAPSHOT information, but this is not really relevant in gae terms. Your application will be deployed at X-Y-Z.latest.myproject-site.appspot.com.

  • Attach the execution of the groovy script to the maven validate phase adding this to the pom.xml

  • This will define a maven property named gaeversion that you can use in your appengine-web.xml file

  • And finally tell to maven to filter our appengine-web.xml resource!