In a previous post I mentioned using the settings.xml file to force maven to use a local repository. In my case this is Jfrog’s Artifactory.
This was accomplished using the “mirror” element in the settings.xml file (example). While most of our artifacts are downloaded from the “central” repository. Some of them have dependencies that are not part of “central”. This resulted in the build reaching out to other 3rd party sites to download artifacts. This is undesirable for us because we want to have control over all artifacts, and in addition this can also slow down the build or even break it when those sites go down. Which is how we discovered it in the first place.
I banged around on google for a while looking for mailing list posts or examples to force mirroring of all repos to no avail. So on my lunch break today I decided to stop by the book store and pick up the Oreilly Maven Book. A couple of minutes poking around and I found an example that setup a mirror using a wildcard.
One Comment
You should be able to prevent maven from going to the central repo by overriding the central & snapshot repository in the pom.xml
See – Overriding the Build-in repositories section:
http://wiki.jfrog.org/confluence/display/RTF/Configuring+Artifacts+Resolution