Sunday, 8 September 2013

Strange maven snapshot download behavior

Strange maven snapshot download behavior

I'm a newbie to Maven. Trying to setup a local Arhiva 1.3.6 server to
serve act as repository server of project internal artifact as well as
mirror to external repos, things work fine except for snapshots. Maven
version is 3.0.5.
here is the mirror setting my settings.xml file
<mirrors>
<mirror>
<id>internal</id>
<mirrorOf>external:*</mirrorOf>
<name>My Maven Repository</name>
<url>http://my.repo.server:9000/archiva/repository/internal/</url>
</mirror>
</mirrors>
During the build maven tries to download the snapshot artifact from the
wrong repository. I have 2 repositories set in parent's parent pom.xml,
internal and snapshots.
<repositories>
<repository>
<id>internal</id>
<url>http://my.repo.server:9000/archiva/repository/internal/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>snapshots</id>
<url>http://my.repo.server:9000/archiva/repository/snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
in project's pom.xml I have the following dependency:
<dependency>
<groupId>com.mygroup</groupId>
<artifactId>metadata-framework</artifactId>
<version>1.0.3.SNAPSHOT</version>
</dependency>
During the build maven tries to do this:
Downloading:
.../archiva/repository/**snapshots**/com/mygroup/metadata-framework/1.0.3.SNAPSHOT/maven-metadata.xml
Downloaded:
.../archiva/repository/**snapshots**/com/mygroup/metadata-framework/1.0.3.SNAPSHOT/maven-metadata.xml
(795 B at 16.9 KB/sec)
Downloading:
.../archiva/repository/**internal**/com/mygroup/metadata-framework/1.0.3.20130908.081541-1/cems-metadata-framework-1.0.3.20130908.081541-1.pom
[WARNING] The POM for
com.myground:metadata-framework:jar:1.0.3.20130908.081541-1 is missing, no
dependen
cy information available
I verified the files in snapshot repo is correct, that it has properly
generated maven-metadata.xml and etc. it appears that maven downloaded the
metadata correctly from snapshot repo, determined the right timestamped
version, but somehow it decided to download the actual file from internal
repo instead of snapshots, which lead to 404 and failed build.
I have no idea how maven works, please help.

No comments:

Post a Comment