aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Should i still use Nexus Repository Manager although I am the only developer in my network? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Should i still use Nexus Repository Manager although I am the only developer in my network?" Watch "Should i still use Nexus Repository Manager although I am the only developer in my network?" New topic
Author

Should i still use Nexus Repository Manager although I am the only developer in my network?

Hilmi Cem
Greenhorn

Joined: Mar 31, 2013
Posts: 3
I recently wanted to integrate Nexus to my home-based Java Project, just to learn what it is good for. As i read from the posts here, and from the nexus Website, its main usage aim is:

Maven Central Repo has more than 200k artifacts. Get a local copy of your artifacts. Do not download every time you need them. When you specify an artifact, first nexus will be asked if it has the artifact, if yes it will be read from your local cache. if not nexus will download it from the central repo. Your build will continue to work regardless of the original artifact in Central Repo. Speed up your builds etc.
Now what i don't understand here is: 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.

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.

In my case, i cant see any advantages of nexus. I now have this settings.xml which Nexus suggests to use:



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?
Saif Asif
Ranch Hand

Joined: Aug 11, 2011
Posts: 440

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.


Muhammad Saif Asif Mirza
OCJA(5/6) OCJP(6) OCJWCD(6)
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

For personal development Nexus is a little bit of overkill (unless you have a second computer and want to use it to store your sources as sort of an automatic backup feature). The local repository that Maven maintains is usually good enough for personal development. I use Nexus at work (wouldn't dream of doing without it), but for my personal stuff the local Maven repository is sufficient.


JBoss In Action
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16145
    
  21

There's really only one thing (I think) that Nexus can do that a one-user/one-computer plain Maven setup cannot, and that's catalog snapshots. But Nexus is a lot of overhead just for that.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Should i still use Nexus Repository Manager although I am the only developer in my network?