As part of our project, we announce our SVN tags in the format:
YYYY-MM-DD - v {project.version} [$ {environment}]
e.g. 2012-01-16 - v1.0.1 [LIVE]
Is it possible to achieve this with the maven-release plugin (version 2.2.2)?
It is worth noting that the version and parts of the environment are received and work with the release plugin. This is a purely temporary mark that cannot be restored.
This is what I would expect:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-release-plugin</artifactId> <version>2.2.2</version> <configuration> <preparationGoals>clean verify</preparationGoals> <tagNameFormat>${timestamp} - v@ {project.version} [${env}]</tagNameFormat> <checkModificationExcludes> . . . </checkModificationExcludes> </configuration> </plugin>
The timestamp property was successfully generated using buildnumber-maven-plugin, as it is added to the manifest file for inclusion in the war file.
I tried to add buildnumber: to create a goal for preparation purposes, but when executing the release, it produces the following output: prepare
What is an SCM release tag or label for "Project Name"? (abcd) null - v1.0.1 [LIVE] ::
The problem seems to be that the timestamp property is not created at the point where tagName is set, which indicates that the preparation goals are not executed at the stage, it requests the name tag.
The following may work (check it after dinner), although I would rather just call release: prepare
mvn buildnumber: create release: prepare
Any input would be welcome.
Greetings
EDIT
I tested using buildnumber: create release: prepare, and it works as expected, although I had to make additional changes to be honest, this is a bit of a pain.
TagNameFormat currently contains:
YYYY-MM-DD - v {project.version} [$ {environment}]
It contains spaces and square brackets, and after executing with this format you will receive an error message indicating that the URL is not URI encoded. To get around this, you must specify tagNameFormat in a format that is already encoded with a URI, for example:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-release-plugin</artifactId> <version>2.2.2</version> <configuration> <preparationGoals>clean verify</preparationGoals> <tagNameFormat>${timestamp}%20-% 20v@ {project.version}%20%5B${env}%5D</tagNameFormat> <checkModificationExcludes> . . . </checkModificationExcludes> </configuration> </plugin>
This is unpleasant, but it works, and it will create the tag as needed.
It would be interesting to know if anyone has any suggestions on how to get the timestamp in tagNameFormat by simply doing:
mvn release: prepare
but not
mvn buildnumber: create release: prepare