We have installed Archiva with the two repositories set by default.
Here is my settings.xml:
<server>
<id>mycompany-release</id>
<username>admin</username>
<password>******</password>
</server>
<server>
<id>mycompany-snapshots</id>
<username>admin</username>
<password>******</password>
</server>
<mirror>
<id>mycompany-release</id>
<url>http://X.X.X.X:8080/archiva/repository/internal/</url>
<mirrorOf>external:*</mirrorOf>
</mirror>
<mirror>
<id>mycompany-snapshots</id>
<url>http://X.X.X.X:8080/archiva/repository/snapshots/</url>
<mirrorOf>apache.snapshots</mirrorOf>
</mirror>
<profile>
<id>repo</id>
<repositories>
<repository>
<id>mycompany-release</id>
<url>http://X.X.X.X:8080/archiva/repository/internal/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>mycompany-snapshots</id>
<url>http://X.X.X.X:8080/archiva/repository/snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
<activeProfiles>
<activeProfile>repo</activeProfile>
</activeProfiles>
I have a parent project that I use to set the common configuration for all the projects. The version of this parent project is 1-SNAPSHOT. So, in all the other projects, the parent section points to this parent project with version 1-SNAPSHOT (without relative path element). If I deploy my parent project to the archiva repository, it is there. If I try to run any command on another project, as mvn clean, it works since the parent project was installed during deployment. But, if I delete manually the parent project from my local repository and try to run the same command, Maven returns an error saying :
Non resolvable parent POM: Could not find artifact com.mycompany:Parent:pom:1-SNAPSHOT in mycompany-release (http://X.X.X.X:8080/archiva/repository/internal/) and 'parent.relativePath' points at wrong local POM
It seems that the parent project is looked up in the release repository while I expected it's looked up in the snapshot repository.
Thanks for your help
EDIT: Here is one part of the child POM:
<parent>
<groupId>com.mycompany</groupId>
<artifactId>Parent</artifactId>
<version>1-SNAPSHOT</version>
</parent>
<groupId>com.mycompany</groupId>
<artifactId>child</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
If I remove the parent section and run mvn help:effective-pom, I get (only repositories is shown):
<repositories>
<repository>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>mycompany-release</id>
<url>http://X.X.X.X:8080/archiva/repository/internal/</url>
</repository>
<repository>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>mycompany-snapshots</id>
<url>http://X.X.X.X:8080/archiva/repository/snapshots/</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Maven Repository Switchboard</name>
<url>http://repo1.maven.org/maven2</url>
</repository>
</repositories>
NOTE: if I replace the parent version by 1 (instead of 1-SNAPSHOT), it works.
I found what was the issue. The problematic line in the settings.xml is:
<mirrorOf>external:*</mirrorOf>
Indeed, it caused Maven to consider the mycompany-release repository as a mirror of mycompany-snapshots repository. But, this repository doesn't mirror snapshots. I replaced this line by:
<mirrorOf>central</mirrorOf>
Now, the mycompany-release repository mirror only the Maven central repository and not the mycompany-snapshots repository, so it looks up the snapshots artifacts in the mycompany-snapshots repository.
Thanks Andrew for your help! I didn't now there was a possibility to display the full log.