Affects Version/s: 2.14.20
Fix Version/s: None
If a GA level release version maven-metadata.xml <versions> list contains an invalid formatted artifact version, such as a version with a leading dash ( ie. -RELEASE ), then uploads of new artifact versions using the POST upload to nexus/service/local/artifact/maven/content with VALID versions may not be automatically added to the maven-metadata.xml versions list maintained by Repository, or will get removed from the existing list upon subsequent uploads of other versions.
Important: Normally Maven rebuilds maven-metadata.xml files - this bug only affects the exceptional case where Repository is responsible for metadata rebuild.
The resulting incomplete versions list in the GA level maven-metadata.xml can fail builds.
Delete ( and optionally re-version the invalid versioned artifacts by re-upload) the improperly versioned artifact from the hosted repository.
Since Maven versioning treats characters such as space and dash as special when performing comparisons, such as when doing sorting, leading an artifact version with these characters is not advised.
This is one way to reproduce the problem that exercises the code in repository manager with the issue:
1. Create a Maven 2 hosted Releases version policy repository called "Nexus_PROD".
2. Deploy a versioned artifact with version: D-899.0.0-400
3. Deploy another version of the artifact: 899.0.0-400
4. Delete using Browse Storage UI this node:
Notice Repository rebuilds the maven-metadata.xml, removing the version from metadata as expected.
5. Manually put the attached maven-metadata.xml into storage at sonatype-work/nexus/storage/Nexus_PROD/Nexus_PROD/example/maven-metadata.xml
6. Then upload again the D-899.0.0-400 version.
7. BUG Download the GA maven-metadata.xml file and check that it contains the uploaded version - it doesn't:
The expected output there should have been:
Normal new Maven artifact versions should always be immediately added to the GA level maven-metadata.xml when using the POST upload method of components.