0

Using maven release:prepare simplifies the process of deploying an artifact. It is possible to define the tag with tag tag. The plugin allows to use properties to build a customized tag-name.

But I need a more customized version, which used "_" insteat of points for delimeters in version. e.g. version: 1.0.1.2 => tagname should be 01_01_01 .

If I could access the majorVersion, minorVersion of ${project.version} this would be a solution too. But it seems that they are not available general.

build-helper plugin seems to be no solution since I call release:prepare and therefore any settings by this plugins will be lost.

Any ideas how to achieve this in an easy manner?

Community
  • 1
  • 1
  • First why would you need that? Why not using the defaults. Extracting the information version infos can be extracted by the build number plugin. – khmarbaise Aug 17 '12 at 11:09
  • @khmarbaise his issue is that he wants to control the tag name that release:prepare tags his SCM with and http://maven.apache.org/plugins/maven-release-plugin/prepare-mojo.html#tagNameFormat is not flexible enough for him – Stephen Connolly Aug 17 '12 at 11:11

2 Answers2

0

The easy way is to always run maven like so

mvn validate release:prepare

Of course if you forget to invoke validate prior to release:prepare your release will be borked... so that's no good.

The next improvement is to have a profile with defaultGoals

<profile>
  <id>prepare-release</id>
  <build>
    <defaultGoal>validate release:prepare</defaultGoal>
  </build>
</profile>

Then you release by doing the non-standard

mvn -Pprepare-release

The true fix would be to suggest a patch to the maven release plugin to allow regex like replacement in the tagNameFormat configuration parameter.

Stephen Connolly
  • 13,872
  • 6
  • 41
  • 63
0

Using Maven-Release Plugin, you can specify the format of the tag you want. Maven Release Plugin run 2 goals: release:prepare and release:perform.

Here you have the necessary targets in your root pom: http://maven.apache.org/maven-release/maven-release-plugin/usage.html

and If you are using Jenkins tool, you can use the Maven Release Plugin to run it, or just run it manually mvn release:prepare and mvn release:perform