Srijani Ghosh
Srijani Ghosh

Reputation: 4216

Maven versions plugin is not working

I need to find a Maven plugin which will update the project versions(There should not be any SCM dependencies)

For example :

change from 0.0.1-SNAPSHOT to 1.0.0

change from 1.0.0 to 1.0.1

change from 1.0.0 to 2.0.0

change from 1.0.0 to 1.0.1-SNAPSHOT

So, I was searching for a plugin and I found versions-maven-plugin .
When I am manually setting the version using versions:set it is working perfectly fine. But, when I need to update it in an incremental fashion I was unable to do it.
I used versions:use-next-releases and versions:use-next-snapshots along with the parameter : -DallowSnapshots=true.
I am not sure why exactly it is not working.

Note:

  1. My project is a simple Java project. I created the java project first and then converted it to Maven project.
  2. I used the dependency as below:

    org.codehaus.mojo versions-maven-plugin 2.1 v@{project.version}

  3. I can not use maven release plugin as my code does not have any SCM.

What is the wrong I am doing here? Please help me out!

Thanks!

Upvotes: 0

Views: 1698

Answers (1)

Daniel
Daniel

Reputation: 4221

Both of these goals (as stated by its documentation) check if the artifact has been released/deployed. Since you are not using any SCM, the plugin probably gets confused.

You could try doing an mvn versions:set -DnewVersion=XXX. It's not as automatic as you would like, but it'll do the trick. We use use it every now and then; it just does a "blind" update (i.e it doesn't check the artifact's SCM, release or deploy status) of the POM's version and parent.version if there is one.

Upvotes: 1

Related Questions