Hello,
First lets see what is nexus and why is it there..
From the Nexus Book.
Nexus manages software "artifacts" required for development, deployment, and provisioning. If you develop software, Nexus can help you share those artifacts with other developers and end-users. Maven’s central repository has always served as a great convenience for users of Maven, but it has always been recommended to maintain your own repositories to ensure stability within your organization. Nexus greatly simplifies the maintenance of your own internal repositories and access to external repositories. With Nexus you can completely control access to, and deployment of, every artifact in your organization from a single location.
The main purpose of nexus is to have a central repository manager among an organization or group of developers which can share jars ( nexus and maven likes to call these jars as 'artifacts' ) . Having a nexus manager setup for a single personal project does not seem feasible . The true power of nexus is when you want to share the artifacts you developed among developers. Instead of copy/pasting these artifacts, nexus provides you with the ability to 'push' ( or publish ) your artifacts on a central repository from where other developers can download and use these jars in their respective projects. Another important feature of nexus is the ability to cache artifacts from the outside world in order to avoid multiple downloads .
So lets say you have a team of 50 developers ( wow , big team ) , who are working on a single project that is dependant on the ( lets assume ) abc.jar . So , if every other developer downloads it separetly , it is a netowrk overhead . What nexus does is , it caches the artifact on the first hit. So instead of 50 downloads of abc.jar , the artifact will be downloaded on the first hit by any off the developer , and then cached by the nexus manager. All subsequent hits ( 49 in this case ) will just retrieve this downloaded artifact from the cache . So we have a speed
boost and a decrease in the netwrok overhead.
Now comes the interesting part. Suppose your team A has developed a set of utility classes and packages which they feel that the other teams in your organization ( lets say B and C ) will want to use. So team A can just publish this artifact on the nexus manager and then the other teams can directly download it like they download any other artifact.
Is it not the same as maven does? First time when i define a new artifact in a pom.xml, the jar will be downloaded from the central repo. It will be placed in ~/.m2/repository. Next time it will be read from here as long as there is a copy of it. Even if i create a new project, the downloaded jars will be used from this repository.
....
The jars i have in /.m2/repository/ directory are exactly same as the jars in http://localhost:8081/nexus/content/groups/public/.
What is the advantage of Nexus in my case?
If you use nexus as a single developer and just to cache your artifacts then yes , it is just like maven and it will not give you any advantage as such.
I think, I would need Nexus if i have another developer in my network, who also needs these jars. So we would not need to download these jars separately from central. We would define a network based repo (Nexus) and the jars would be downloaded to this repository. Other developers would reach this repo without the need of reaching central repo.
Correct. This is what will speed up the development process and also decrease un-neccesary network hits.
Your settings.xml is correct except for the url part
You have to give the path of the maven central repo here.
Also another thing I want to share with you from my experience is the mirrorOf tag
<mirrorOf>*</mirrorOf>
If you specify * here , it means mirror of EVERYTHING. Now we know that nexus can be used to host a number of virtual repositories and it can also manage proxy repositories. So by far, if we configure nexus correctly , the dev teams will just have to hit the nexus repo and it will get the artifacts from any repository , this includes maven central ,
jboss central or any other repository that you want to configure.
I myself have a nexus repo setup for my company and I have configured it to talk to a number of external repositories like jboss , maven central , atlassian etc etc. So any developer in any of the team , just has to hit my nexus repo and it will get the required artifact from any of the repo I have configured it to search in.