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?
This plugin is used to release a project with Maven, saving a lot of repetitive, manual work. Releasing a project is made in two steps: prepare and perform. Note: Maven 3 users are encouraged to use at least Maven-3.0. 4 due to some settings related issues.
mvn release:prepareThis command prepares for a release in SCM. It goes through several phases to ensure the POM is ready to be released and then creates a tag in SVN which can be used by release:perform to make a release.
Assuming that SCM has been configured in the pom. xml and the project directory is managed by a SCM, invoking the checkin goal in the scm will start the commit process for all configured sources in your pom. xml . The files should be added beforehand by an external scm client.
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>
It looks like this is not possible until one of these bugs is fixed:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With