Using maven plugin versions-maven-plugin's <goal>use-latest-releases</goal> for latest releases

700 views Asked by At

Used < goal> use-latest-releases </ goal> for newer release(all non-SNAPSHOT) and replaces pom's version with the latest releases. I have added dependency(on which current project is dependent) in the pom.xml with < version> [anyVersionNumber] < /version>.

When I am running "mvn clean package", build is getting failed with error message Could not resolve dependencies for project < sample>:jar:0.1: Could not find artifact < some>:jar:[anyVerionNumber]

versions-maven-plugin supposed to update < version>[anyVersionNumber]</ version> with < version>[latest release]</ version> in my pom.xml.

Any idea how could I get latest release by using this maven plugin?

1

There are 1 answers

0
J Fabian Meier On

Sorry, but it does not work that way.

First of all, you probably cannot update a version number unless you put in a valid one first.

Secondly, you cannot update and use a version in the same Maven run. Maven uses the versions as they were at the beginning of the Maven run, so changing them in between does not help.

So first run mvn versions:use-latest-releases and then run mvn clean package.