I have single project setup where I am using versions-maven-plugin
to get latest release.
When I ran mvn clean
before mvn package
, getting updated message which specify
[INFO] Updated old_version:jar:0 to version new_version.
But when I ran mvn clean package
together then maven not able to get latest version and I got this error message
Could not find artifact old_version:jar:0
Why is this happening? If maven follows the order of execution then it should clean which updates the version first then package.
Any idea why mvn clean package
command is not working.
Running mvn clean
and then mvn package
is not exactly the same as mvn clean package
.
The reason: Maven resolves all dependencies before it runs any of the lifecycles.
So if you run mvn clean
and then mvn package
you get:
but if you run mvn clean package
, you get:
Summarized: You cannot update and use dependencies in the same Maven run.