Thursday, September 24, 2009

Use exotic Maven repositories with your local mirror

This is a little tip you must know if you have an "in-house" maven repository mirros (such as Artifactory) and if you want to access to an exotic one.

What's an exotic repository? My definition of that is a repository hosted by a developer isolated somewhere on the web. Of course, it's not a mirror of the official one. By the way, you should not declare it on you "in-house" mirror but simply write the following lines in your pom.xml :

<repositories>
<repository>
<id>violet.repo</id>
<name>Violet's Maven repository (public access)</name>
<url>http://violet.sourceforge.net/maven2/repo/</url>
</repository>
</repositories>



Now, imagine you try to retrieve an artefact. Muupp... error! You miss to declare an exclusion in your settings.xml to inform Maven that it should not use your local mirror to get it. Thus, this is an example of what to do :

<mirrors>
<mirror>
<id>artifactory</id>
<mirrorof>*,!violet,!wicketstuff,!google</mirrorof>
<url>http://localserver:8080/artifactory/repo</url>
<name>Artifactory</name>
</mirror>
</mirrors>


You understood the "!" character? M...kay... That's all for today.

1 comment:

Rahul said...

Thanks for the great information in your blog Selenium Training in Chennai