Why are the "latest" and "release" tags in maven-metadata.xml not being updated after deploying artifacts?

The maven-metadata.xml files are not updated by Nexus during deployment, they are updated by Maven. It downloads the file, updates it, and then redeploys it.

Maven will update the "release" field only during the following scenarios:

1. Maven 2.x deploys using -DupdateReleaseInfo=true
2. Maven 3.x deploys a non-snapshot artifact

The "latest" field is only intended for plugin resolution, and is only set upon deployment of a maven-plugin artifact, both for Maven 2.x and 3.x regardless whether a release or snapshot gets deployed.

Also, Maven will update these fields with whatever version it is currently deploying, so "latest" and "release" will not necessarily correspond to the highest version number.

Note that Nexus will set the latest tag if you tell it to rebuild metadata, but since Maven does not this behavior cannot be relied upon.

If you need the highest version of a released non-plugin artifact you should be using version ranges, see section 3.4.3 here.

If you're trying to retrieve the latest timestamped version of a snapshot you can use the REST API as described here.


Have more questions? Submit a request


Article is closed for comments.