I am using maven 3 and nexus for deploying our artifacts toa repository,
I saw that the non-unique option was deprecated in maven 3 so all SNAPSHOTS artifacts are being deployed with a timestamp and I am cool with that, the problem is that it looks like all artifacts are not under the version I specified (0.6-SNAPSHOT) so when I try to get this dependency the build is failing because it can't find it.
This is the dependency definition in the pom:
<dependency>
<groupId>com.globals</groupId>
<artifactId>globals-general</artifactId>
<version>0.6-SNAPSHO</version>
</dependency>
And this is the error I get when I try to get the dependency:
Failed to execute goal on project mprest-mgrid-infra-cache: Could not resolve dependencies for project com.mprest.mgrid.infra:mprest-mgrid-infra-cache:jar:0.6-SNAPSHOT: Could not find artifact com.mprest.mgrid.globals:mprest-mgrid-globals-general:jar:0.6-SNAPSHOT ->
This is my pom relevant part:
<distributionManagement>
<snapshotRepository>
<id>nexus-snapshots</id>
<url>http://nexus:8081/repository/maven-snapshots/</url>
</snapshotRepository>
<repository>
<id>nexus-releases</id>
<url>http://nexus:8081/repository/maven-releases/</url>
</repository>
</distributionManagement>
And this is the structure:
The structure is ok, under 0.6-SNAPSHOT there are all the 0.6-SNAPSHOTs with time stamps, and maven-metadata.xml pointing to the latest artifact.
It turns out I needed to add the repositories in a certain way inside the settings.xml in order for me to be able to get the artifacts.
This is what it looks like:
<servers>
<server>
<id>nexus-snapshots</id>
</server>
<server>
<id>nexus-releases</id>
</server>
<server>
<id>maven-group</id>
</server>
</servers>
<mirrors>
<mirror>
<id>maven-group</id>
<name>maven-group</name>
<url>http://nexus:8081/repository/maven-group/</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>allow-snapshots</id>
<activation><activeByDefault>true</activeByDefault></activation>
<repositories>
<repository>
<id>nexus-snapshots</id>
<url>http://nexus:8081/repository/maven-snapshots/</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
<repository>
<id>nexus-releases</id>
<url>http://nexus:8081/repository/maven-releases/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>false</enabled></snapshots>
</repository>
</repositories>
</profile>
</profiles>
</settings>