mavennexussonatypemaven-metadata

Maven SNAPSHOT version not loaded from Nexus


We have a Sonatype Nexus running in our environment which has another Nexus as proxy repository configured. When we consume our dependencies we ask our Nexus for them. This worked fine until yesterday when I added a new dependency to our project.

It seems that Maven is not properly resolving the snapshot versions that are deployed. In the maven log I can see that it is downloading the maven-metadata.xml but when it tries to download the zip file containing our binaries, it does not replace the -SNAPSHOT with the current snapshot version

> mvn -f My.Product.dependencies.xml process-resources -DConfiguration=AnyConfig -U -X

[DEBUG] Could not find metadata com.company.team:My.New.Dependency:2.2-SNAPSHOT/maven-metadata.xml in local (d:\Maven\repositories)
[DEBUG] Using connector WagonRepositoryConnector with priority 0 for http://buildserver:8082/nexus/content/groups/company
Downloading: http://buildserver:8082/nexus/content/groups/company/com/company/team/My.New.Dependency/2.2-SNAPSHOT/maven-metadata.xml
Downloaded: http://buildserver:8082/nexus/content/groups/company/com/company/team/My.New.Dependency/2.2-SNAPSHOT/maven-metadata.xml (850 B at 13.2 KB/sec)
[DEBUG] Reading resolution tracking file d:\Maven\repositories\com\company\team\My.New.Dependency\2.2-SNAPSHOT\resolver-status.properties
[DEBUG] Writing resolution tracking file d:\Maven\repositories\com\company\team\My.New.Dependency\2.2-SNAPSHOT\resolver-status.properties
[DEBUG] Could not find metadata com.company.team:My.New.Dependency:2.2-SNAPSHOT/maven-metadata.xml in local (d:\Maven\repositories)
[DEBUG] Using connector WagonRepositoryConnector with priority 0 for http://buildserver:8082/nexus/content/groups/company
Downloading: http://buildserver:8082/nexus/content/groups/company/com/company/team/My.New.Dependency/2.2-SNAPSHOT/maven-metadata.xml
Downloaded: http://buildserver:8082/nexus/content/groups/company/com/company/team/My.New.Dependency/2.2-SNAPSHOT/maven-metadata.xml (850 B at 55.3 KB/sec)
[DEBUG] Reading resolution tracking file d:\Maven\repositories\com\company\team\My.New.Dependency\2.2-SNAPSHOT\resolver-status.properties
[DEBUG] Writing resolution tracking file d:\Maven\repositories\com\company\team\My.New.Dependency\2.2-SNAPSHOT\resolver-status.properties
...
Downloading: http://buildserver:8082/nexus/content/groups/company/com/company/team/My.New.Dependency/2.2-SNAPSHOT/My.New.Dependency-2.2-SNAPSHOT-vs2010-40-AnyCpu-Release.zip
[DEBUG] Reading resolution tracking file d:\Maven\repositories\com\company\team\My.New.Dependency\2.2-SNAPSHOT\My.New.Dependency-2.2-SNAPSHOT-vs2010-40-AnyCpu-Release.zip.lastUpdated
[DEBUG] Writing resolution tracking file d:\Maven\repositories\com\company\team\My.New.Dependency\2.2-SNAPSHOT\My.New.Dependency-2.2-SNAPSHOT-vs2010-40-AnyCpu-Release.zip.lastUpdated
[INFO] ------------------------------------------------------------------------
...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] My.Client.App  FAILURE [1.922s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.687s
[INFO] Finished at: Thu Oct 13 09:54:24 CEST 2016
[INFO] Final Memory: 9M/177M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project My.Client.App: Could not resolve dependencies for project com.company.team2:My.Client.App:pom:7.0-SNAPSHOT: The following artifacts could not be resolved: com.company.team:My.New.Dependency:zip:vs2010-40-AnyCpu-Release:2.2-SNAPSHOT: Could not find artifact com.company.team:My.New.Dependency:zip:vs2010-40-AnyCpu-Release:2.2-SNAPSHOT in company (http://buildserver:8082/nexus/content/groups/company) -> [Help 1]

The maven-metadata.xml contains properly the snapshot version information:

<?xml version="1.0" encoding="UTF-8"?>
<metadata modelVersion="1.1.0">
  <groupId>com.company.team</groupId>
  <artifactId>My.New.Dependency</artifactId>
  <version>2.2-SNAPSHOT</version>
  <versioning>
    <snapshot>
      <timestamp>20161011.235855</timestamp>
      <buildNumber>102</buildNumber>
    </snapshot>
    <lastUpdated>20161011235855</lastUpdated>
    <snapshotVersions>
      <snapshotVersion>
        <extension>pom</extension>
        <value>2.2-20161011.235855-102</value>
        <updated>20161011235855</updated>
      </snapshotVersion>
      <snapshotVersion>
        <classifier>vs2010-40-AnyCPU-Release</classifier>
        <extension>zip</extension>
        <value>2.2-20161011.235855-102</value>
        <updated>20161011235855</updated>
      </snapshotVersion>
    </snapshotVersions>
  </versioning>
</metadata>

When I check the directory listing of the folder where it downloads the stuff from, the 2.2-20161011.235855-102 version is properly there:

Nexus Directory Listing

All other dependencies from the same repository work perfectly fine, just the newly introduced one is not dowloaded. It currently drives me crazy that Maven is not replacing the -SNAPSHOT with the actual snapshot version number like it does for all the other dependencies. I also tried the options "Expire Cache" and "Update Index" in the Nexus UI but that didn't help. What could cause Maven to fall back from the actual version number to the -SNAPSHOT? There is also no log entry that would explain this.


Solution

  • After trying 1 million things and comparing the configuration of the other dependencies with the new ones I finally found the issue: The artifact ids (classifiers) are case sensitive. In my client POM file I was referring to vs2010-40-AnyCpu-Release but deployed is vs2010-40-AnyCPU-Release (notice the capital AnyCPU).

    In the logfile you can see that it tries to download a file with lowercase AnyCpu. After I changed it to uppercase it worked.