I am using Jenkins (Hudson) with the Grails plugin to do builds as I update svn. I found this example script that allows you to incorporate a build number from an env var:
set-version 1.1.0.${env['BUILD_NUMBER']}
But as you see, the prefix is hard-coded. I’d like to use the version number set in the application.properties file. How can I do something like:
set-version ${app.version}.${env['BUILD_NUMBER']}
Have tried a variety of scopes/syntax to no avail.
It is not possible out of the box. Jenkins or specifically the Grails plugin does not read the content of the
application.propertiesfile and hence the existing application version is not available as a variable.You might want to consider writing a custom script in your application (like
append-version) that will readapplication.propertiesand append the value passed in. You can call the existing set-version script modifying the argument.I have also created a simple script that should do the job: