Monday, June 2, 2008

Maven 2 and Apache Archiva

Recently I've started to use Archiva as a Maven 2 repository and I had this unexpected behaviour when using it. First of all I've configured a profile in /home/mpigulski/.m2/settings.xml and added there a repository that was pointing to my Archiva repository. It was working fine, but every time the central repoistory was looked up then my Archiva server was skipped in the path and the whole idea of Archiva as a Maven 2 repository proxy was missed.

I've started digging again and found this configuration option.

After adding this to my settings.xml looked something like this:

<settings>
...
<mirrors>
<mirror>
<id>internal</id>
<name>Internal Mirror of http://repo1.maven.org/maven2/</name>
<url>http://archiva:8001/archiva/repository/internal/</url>
<mirrorof>central</mirrorof>
</mirror>
</mirrors>
...
</settings>


After this, every call to the central repository is overriden by this mirror configuration and every jar downloading is performed very fast.