i need some insight on how Maven supports setup of private plugin repositories. Having internal private repositories (on nexus/artifactory) helps hosting third party jars and project snapshot jars. However, each developer in the project needs to download the maven plugins from the Maven central repository(like maven-compiler-plugin, maven-jar-plugin etc).
Is is possible to have all these plugins available in the internal private repository (on nexus/artifactory) so that the users can simply get them via the internal repo and can even work offline, while the internal repo is made to have all the plugins along with the artifacts that they need for their work?
Both Nexus and Artifactory can be configured to work as mirrors of central repositories. Indeed, the people who host the central repositories even encourage you to setup mirrors, so you don;t overload them.
The way you do this is
a) Setup Nexus/Artifactory internally to mirror central Maven/Jboss/any 3rd party repo
b) Setup your pom.xml to only look at your internal repo
When you run a build, maven will look up your local repo (the one that resides ON the node that is running the build). If it doesn't find it in local repo, it looks up your internal repo. The internal repo looks up in it's own local repo. If internal repo doesn't find it, it looks up the central repo that it mirrors. Internal repo downloads the artifact, puts it in it's own local repo and returns it to the caller. Maven takes it and puts it in the local repo.
Next time the same node does the build, maven will get it from the local repo on the node. Once the node has downloaded all artifacts, it can work offline. If some other node does the same build, the interbnal repo will serve up the artifact from it's local repo and avoid the call to the central repo.
I've done this in Artifactory, and it works beautifully. Another advantage is that Artifactory creates a seperate cache for every central repo that it caches. Once in a while I go there and look through it to see if all the artifacts are coming from the correct sources.
In my case, unfortunately things are a little more complicated. Given a setup where the intended internal mirror's host box does not have internet connectivity, whereas the nodes do; is there a way to update the mirror host either manually or via furnishing it's local repository?
Hmm spotty connections on internal repo will be problematic since you don't want to complete mirror the whole central repo. If you ask the Maven folks nicely they can help you setup your repo as a complete mirror. However, it;s going to cost you a lot in terms of space
You can add artifacts manually to Artifactory, but you will be spending a lot of time adding artifacts. Remember you need to add depdnencies, and dependencies of dependencies, and dependencies of dependencies of dependencies.. and so on
I have to say your setup is wierd. WHat's the reason behind the internal repo not having connectivity? Security? If your nodes have access to the internet, why not just setup the internal repo on a node?
Joined: Oct 11, 2012
I am in 100% agreement with you, my setup really is weird. The reason is mostly red tapes and unflexible org structures.