aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Private plugin repository for Maven project. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Private plugin repository for Maven project." Watch "Private plugin repository for Maven project." New topic
Author

Private plugin repository for Maven project.

Gaurav Upadhyay
Greenhorn

Joined: Oct 11, 2012
Posts: 10
Greetings.

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?

Thanks
Gary
Jayesh A Lalwani
Bartender

Joined: Jan 17, 2008
Posts: 2052
    
  22

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.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5776
    
    7

I have done the same with Nexus, so all of the benefits Jayesh mentions for Artifactory apply to it also. I wouldn't work in a Maven environment without such a repository manager!


JBoss In Action
Gaurav Upadhyay
Greenhorn

Joined: Oct 11, 2012
Posts: 10
thanks for the reply.

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?
Jayesh A Lalwani
Bartender

Joined: Jan 17, 2008
Posts: 2052
    
  22

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?


Gaurav Upadhyay
Greenhorn

Joined: Oct 11, 2012
Posts: 10
I am in 100% agreement with you, my setup really is weird. The reason is mostly red tapes and unflexible org structures.

however, thanks for your inputs .

thanks
_G
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Private plugin repository for Maven project.
 
Similar Threads
Software Development/Maven/Eclipse
Simple MAVEN questions
Maven Local repository Vs nexus
Roo and PGP add-ons
Ant + Ivy: Add 3rd party stuff to shared repository