My maven artifact is deployed to a Nexus snapshot repository. There, it is stored in the correct directory, but its filenames have the following pattern:
mylibrary-1.0-20130213.125827-2.jar
However, Maven fails to download that snapshot. According to the error log, Maven seems to expect the following file name:
mylibrary-1.0-SNAPSHOT.jar
These are the repository settings in my pom:
<repositories>
<repository>
<id>mycompany-all</id>
<url>https://servername/nexus/content/groups/mycompany/</url>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>mycompany-releases</id>
<url>https://servername/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>mycompany-snapshots</id>
<url>https://servername/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
Note: the nexus group includes both the releases
and snapshots
repo.
I did not configure these repos in settings.xml
- is that the problem? Or what else am I doing wrong?
I made it work by adding the repositories to the
settings.xml
like this:Then, the SNAPSHOT jar files were downloaded just fine. I suspect that when Maven knows it deals with a snapshot repo, it tries both with and without uniqueVersion (see Duncan Jones' answer).
Note that in our case these blocks had to be duplicated as
pluginRepositories
because we have custom Maven plugins.The pattern you posted (
mylibrary-1.0-20130213.125827-2.jar
) is a unique snapshot version. Maven 3 forces you to use this type of artifact naming, but in Maven 2 it can be prevented with a statement such as:To use a specific snapshot in your project, declare it as:
To use the latest known snapshot, declare it "old-style":
You may find the answer to this similar question helpful as well.