In our SVN repo, we store tags like this:
trunk
project_a
project_b
branches
project_a
branch_x
branch_y
project_b
tags
project_a
1.0
1.1
project_b
1.0
When I run the Maven release plugin's "prepare" goal on project A, by default it creates the tag as "tags/project_a-x.x", which does not match my tag naming scheme above. I am thus depending upon whoever does the release (i.e. a fallible human) to spot this and change the tag to "tags/project_a/x.x". How can I tell the release plugin to use the correct format by default?
The "prepare" goal has a "tag" configuration option that claims to do this, but if I set it as follows:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.1</version>
<configuration>
<tag>${project.artifactId}/${project.version}</tag>
</configuration>
</plugin>
... then the created tag is "tags/project_a/x.x-SNAPSHOT", i.e. it uses the pre-release version number instead of the release version number. Hardcoding the tag name into the POM seems wrong too.
How can I ensure that the tag is correct by default?
The release plugin now supports the tagNameFormat
configuration option, which defaults to @{project.artifactId}-@{project.version}
. In your case, you could do something like:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<tagNameFormat>@{project.artifactId}/@{project.version}</tagNameFormat>
</configuration>
</plugin>