Nexus - Repository Manager

Nexus is repository Manager where you can

1. Proxy public repositories, which will act as local private repository.

2. Host private build artefacts

By setting up nexus proxy the time to receive an artefact is reduced and it saves bandwidth. Since nexus downloads the artefacts from central repository to its local, the time to receive the libraries will be faster saving the bandwidth.

There are many cases where third party libraries are used, since the libraries will not be available in the Maven Central repository build will not be successful. To make it available, the libraries can be added to nexus which will act as a local central repository to serve both Central repository and Userdefined or third party libraries. So, without each developer changing their settings, the libraries can be made available through nexus.

There are many cases where different developers download different version of a library(say spring), without having any control of which version is used in common. You can restrict this by uploading only the project released libraries to the nexus private repository( which need to be created), which will hold only the versions of libraries to be used by all developers.

Configuring Maven to use Nexus Repository

Configure maven to use nexus instead of public repository.

First edit mirror settings in ~/.m2/settings.xml file

<?xml version="1.0"?>

<settings>

...

<mirrors>

<mirror>

<id>Nexus</id>

<name>Nexus Public Mirror</name>

<url>http://localhost:8080/nexus/repository/maven-central/</url>

<mirrorOf>central</mirrorOf>

</mirror>

</mirrors>

...

</settings>

Once Nexus is configured to be the mirror for all repositories, Maven will consult the local installation of Nexus instead of going out to the central Maven repository. If Nexus has the artefact requested, the artefact will be served from the local Nexus installation. If Nexus does not have the artefact, Nexus will retrieve it from the remote repository and then add it to the local mirror of that remote repository.

Using Nexus to Snapshot repositories

Once