Maven Release Properties

When we release projects, every time it is the same. Are there any arguments or properties that I can add for release: get ready to let the template free in batch mode?

Example:

 What is the release version for "MyProject"?  (company.jar.site:myproject) 0.0.1:: 
 What is SCM release tag or label for "MyProject"?  (company.jar.site:myproject) MyProject-0.0.1:: 
 What is the new development version for "MyProject"?  (company.jar.site:myproject) 0.0.2-SNAPSHOT:: 

It would be nice to do something like this:

 mvn -B release: perform -DreleaseVersion: $ nextMinorVersion $ or
 mvn -B release: perform -DreleaseVersion: $ nextPatchVersion $ or
 mvn -B release: perform -Dtag: v $ nextPatchVersion $ or
 mvn -B release: perform -Dtag: v $ nextPatchVersion $ -someCustomNaming 

If something like this does not exist yet, I will create a custom Mojo for this.

As an alternative, during the above prompts, we usually set the first question by default: "v" + the current version on the second, and the next minor on the last. If we could somehow change them, this would solve the immediate problem.

Thanks in advance.

+7
java maven-2 release
source share
3 answers
mvn -B release:prepare release:perform 

-B is for batch mode, it will use the default settings that it offers in non-batch mode. Usually for XYZ-SNAPSHOT he releases XYZ and sets a new snapshot to XY (Z + 1) -SNAPSHOT.

As with all maven stuff, you can fight this naming convention and have a lot of headaches, or give up and decide that your versions and shortcuts will be the maven way and get a lot for free. I fought with him and lost. Only one of the many ways you should pass maven completely if you intend to use it.

I am completely happy that I did this, wanting to impose my own schemes, as a rule, this is not a good idea.

+7
source share

Partial answer, after your comment :

To change the tag name, use the -Dtag=xxx argument to release:prepare . For more details see the release: prepare the documentation .

Invalid Code Warning

To do this in a completely automatic way, you need to add a configuration entry to your pom.xml, where you must set the tag name:

 <maven-release-plugin> <configuration> <tag>parent-${releaseVersion}</tag> </configuration> </maven-release-plugin> 
+2
source share

As I did, running a non-interactive version using a properties file .

You create release.properties in the root of the aggregator project (the one that has the package: pom), and for each project you add two properties of the following form:

 project.rel.<groupId>\:<artifactId>=<releaseVersion> project.dev.<groupId>\:<artifactId>=<nextSnapshotVersion> 

if you want to use a specific literal for your tag, you add the following property

 scm.tag=<tagLiteral> 

Below is an example where both things are performed (specify the version of each module and determine the literal that will be used for tags in SCM):

 scm.tag=my-project-0.2.1 project.rel.org.monachus.monkeyisland\:my-project=0.2.1 project.dev.org.monachus.monkeyisland\:my-project=0.2.2-SNAPSHOT project.rel.org.monachus.monkeyisland\:module-a=0.1.1 project.dev.org.monachus.monkeyisland\:module-a=0.1.2-SNAPSHOT 
+1
source share

All Articles