A local instance of Nexus (or another repository manager) can significantly improve the speed of your builds, especially if/when the time comes to clean out your local repository. For example, if you want to build with a clean local repository to be absolutely sure that your build is not dependent on some locally cached jar file.
The process to set up a local Nexus instance is relatively quick and painless. And if you are not happy with the results, you can always remove it.
Step 1 - Download and Install Nexus OSS
Nexus can be downloaded for free from Sonatype's web site (http://nexus.sonatype.org/download-nexus.html)
I recommend starting out with the bundle zip since this is probably the easiest to set up.
After downloading the bundle zip, just unzip it, and then run the appropriate startup script for your platform located under $NEXUS_HOME/bin/jsw
$NEXUS_HOME/bin/jsw/linux-x86-32/nexus start
If you need more detailed instructions, for example how to set up Nexus as a service, the process is well documented also at Sonatype's web site (http://www.sonatype.com/books/nexus-book/reference/install.html)
Step 2 - Configure Nexus to Use JBoss and other Maven repositories
The Nexus UI should now be available via your web browser
http://localhost:8081/nexus
Log in with the default username (admin) and password (admin123), and now you can add local proxies to the various jboss Maven repositories (Maven Repository). For example to add a proxy to the jboss public group, use settings similar to the following.
Note: There is one tricky part to this, Nexus proxy repositories can be snapshot repositories or release repositories, and the "public" group includes both snapshots and releases.
https://repository.jboss.org/nexus/content/groups/public/
So you'll probably want to create two proxy repositories both pointing to the jboss "public" group, and set the Repository Policy of one to "Release" and the other to "Snapshot". Then you have to create a repository group which includes both of these proxy repositories. Then you will have a local repsitory which matches the contents of the "public" group.
Now you should have a repository group on your local Nexus which looks something like the following.
http://localhost:8081/nexus/content/groups/jboss-public/
Step 3 - Configure Local Maven Mirror Settings
The next step is to configure Maven to use your local Nexus instance instead of using the remote repository URL.
<mirrors> <mirror> <id>local-jboss-public</id> <name>Paul Server JBoss Public</name> <mirrorOf>jboss-public-repository-group</mirrorOf> <url>http://localhost:8081/nexus/content/groups/jboss-public</url> </mirror> </mirrors>
Make sure the name in "mirrorOf" matches the name you specified in the pom or settings.xml
Step 4 - Build
Now try running a Maven build and see if it works. The first build with a clean local repo may take a while as the local Nexus instance is populated. However, subsequent builds using a clean local repository will have blazingly fast download speeds!
.
Comments