26 August 2008

Do You Use Maven? If So, You Need Nexus



If you use Maven for your development or you manage a Maven repository inside your company then you need a Maven repository manager and Nexus is hands-down the best choice. Today Sonatype announced the release of Nexus 1.0, the easiest to use, enterprise-ready Maven repository manager.

Nexus serves as a proxy between your organization and public Maven repositories and as an easy-to-use deployment target for your own, possible commerical artifacts.

Nexus acts as a cache of artifacts between your organization and any public Maven repository. This means that artifacts and their dependencies only need to be downloaded once. I run Nexus locally on my laptop for this purpose and after the first download of artifacts, my builds sped up tremendously. I've done this since it was called Proximity because it works very well.

A shared, internal Maven repository inside of a company can be a very efficient way to share snapshots and releases of internal projects. Using Nexus dramatically simplifies this task and saves large amounts of time and effort.

Start Using Nexus in Minutes

If you want to speed up your Maven builds, follow these steps:


  1. Download Nexus

  2. Start up Nexus ($NEXUS_HOME/bin/nexus start)

  3. Drop this settings.xml in your ~/.m2/ directory

  4. Perform a Maven build



You might need to add more repositories to Nexus, but it's a cakewalk! Trust me, Nexus will simplify your use of Maven.

8 comments:

  1. Thanks for this Bruce. I've been meaning to try out Nexus but didn't realize how easy it was till your post. :)

    BTW did you notice a big speed increase over your previous mirroring system? I did.

    ReplyDelete
  2. Awesome! I'm glad this post helped you, Jon. I left a comment on your blog post, too. IMO, use of Nexus is just a no-brainer.

    ReplyDelete
  3. This comment has been removed by a blog administrator.

    ReplyDelete
  4. How does Nexus compare with Artifactory? My company has been happily using that for a while, and I'm curious which is better.

    ReplyDelete
  5. It was very interesting for me to read the post. Thanks for it. I like such topics and anything that is connected to them. I would like to read more on that blog soon.

    ReplyDelete
  6. Hi Can you send me the Settings.xml to vsvarun1988@gmail.com

    ReplyDelete
  7. The following settings.xml used to work, I'm not sure if it still does:


    <settings>

    <mirrors>
    <mirror>
    <!--This is used to direct the public snapshots repo in the
    profile below over to a different nexus group -->
    <id>nexus-public-snapshots</id>
    <mirrorOf>public-snapshots</mirrorOf>
    <url>http://localhost:8081/nexus/content/groups/public-snapshots</url>
    </mirror>
    <mirror>
    <!--This sends everything else to /public -->
    <id>nexus</id>
    <mirrorOf>*</mirrorOf>
    <url>http://localhost:8081/nexus/content/groups/public</url>
    </mirror>
    </mirrors>


    <profiles>
    <profile>
    <id>development</id>
    <repositories>
    <repository>
    <id>central</id>
    <url>http://central</url>
    <releases><enabled>true</enabled></releases>
    <snapshots><enabled>true</enabled></snapshots>
    </repository>
    </repositories>
    <pluginRepositories>
    <pluginRepository>
    <id>central</id>
    <url>http://central</url>
    <releases><enabled>true</enabled></releases>
    <snapshots><enabled>true</enabled></snapshots>
    </pluginRepository>
    </pluginRepositories>
    </profile>
    <profile>
    <!-- this profile will allow snapshots to be searched when activated -->
    <id>public-snapshots</id>
    <repositories>
    <repository>
    <id>public-snapshots</id>
    <url>http://public-snapshots</url>
    <releases><enabled>false</enabled></releases>
    <snapshots><enabled>true</enabled></snapshots>
    </repository>
    </repositories>
    <pluginRepositories>
    <pluginRepository>
    <id>public-snapshots</id>
    <url>http://public-snapshots</url>
    <releases><enabled>false</enabled></releases>
    <snapshots><enabled>true</enabled></snapshots>
    </pluginRepository>
    </pluginRepositories>
    </profile>
    </profiles>

    <activeProfiles>
    <activeProfile>development</activeProfile>
    <activeProfile>public-snapshots</activeProfile>
    </activeProfiles>

    </settings>

    ReplyDelete