DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Beyond HTTP Handoffs: Build Durable Agent-to-Agent Services With Temporal Nexus
  • Redefining Artifact Storage: Preparing for Tomorrow's Binary Management Needs
  • Publishing MuleSoft Common Assets or Libraries to Anypoint Exchange and Nexus

Trending

  • A Reference Architecture for Constrained AI-Assisted Design
  • How to Migrate From C/C++ to Rust: A Practical Guide for Embedded IoT Systems
  • AI-Era Cybersecurity, Part 1: Mapping Glasswing, Daybreak, Lightwell and the Tools Racing to Find and Fix Bugs
  • DZone's Article Types

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. Getting started with Nexus Maven Repo Manager

Getting started with Nexus Maven Repo Manager

By 
Vineet Manohar
·
Jun. 07, 10 · Interview
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
105.5K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

This tutorial outlines steps required to install Nexus (Maven Repository Manager) under Tomcat, or another webapp container. It shows you practical configuration and includes code snippets that go in your pom.xml and settings.xml in order to read and publish artifacts to your Nexus server.

Step 1: Download

Download Nexus from here (at the time of writing, latest is 1.6.0)

Step 2: Install

Copy the war to TOMCAT_HOME/webapps/nexus.war

Though not required, it is a generally good idea to restart tomcat after installing a new war

  /etc/init.d/tomcat restart  
/etc/init.d/tomcat restart

Step 3: Configure security

a) Change default admin password: The default admin username/password is admin/admin123. Login as admin and change the password to a secure password.

Login -> [admin, admin123] -> Left Menu -> Security -> Change Password -> click “Change Password”

b) Anonymous Access: By default Nexus is open to the public. If you want to secure access to nexus, disable ‘Nexus anonymous user’

Admin -> Left Menu -> Users -> ‘Nexus anonymous user’ -> Status=Disabled

c) Deployment user: Change password for deployment user

Admin -> Left menu -> Users -> Deployment user -> Change email address

Admin -> Left menu -> Users -> Right click on ‘Deployment user’ in the user list -> Set Password -> click ‘Set password’ to finish

Step 4: Set SMTP server

It is a good idea to configure SMTP server, so that you can receive emails from Nexus.

Admin login -> Left menu -> Administration -> Server ->SMTP Settings -> (host localhost, port 25, no login, no password mostly works on a linux machine)

Step 5: Change Base Url

If you are running Nexus behind Apache using mod_jk or mod_proxy, change your base url here.

Admin login -> Left menu -> Administration -> Server -> Application Server Settings -> Base url

Step 6: Add a task to periodically remove old snapshots

If you or your CI server publishes snapshots to Nexus several times a day, then you should consider adding a task to delete duplicate/old snapshots for the same GAV (group, artifact, version). If you don’t do this, you will notice that the Nexus disk usage will increase with time.

Admin login -> Left menu -> Administration -> Scheduled tasks -> Add… -> name=”Remove old snapshots”, Repository/Group=Snapshots (Repo), Minimum Snapshot Count=1, Snapshot Retention(days)=3, Recurrence=Daily, Recurring time=2:00 -> click ‘Save’

Step 7: Using Nexus: reading and publishing artifacts

If you want to deploy your artifacts to your Nexus, you need to configure 2 files: pom.xml and settings.xml

a) pom.xml – for each project which wishes to publish to Nexus, add your repo to the pom.xml

<distributionManagement>
<!-- Publish the versioned releases here -->
<repository>
<id>vineetmanohar-nexus</id>
<name>vineetmanohar nexus</name>
<url>dav:http://nexus.vineetmanohar.com/nexus/content/repositories/releases</url>
</repository>

<!-- Publish the versioned releases here -->
<snapshotRepository>
<id>vineetmanohar-nexus</id>
<name>vineetmanohar nexus</name>
<url>dav:http://nexus.vineetmanohar.com/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>

<!-- download artifacts from this repo -->
<repositories>
<repository>
<id>vineetmanohar-nexus</id>
<name>vineetmanohar</name>
<url>http://nexus.vineetmanohar.com/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>

<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>

<!-- download plugins from this repo -->
<pluginRepositories>
<pluginRepository>
<id>vineetmanohar-nexus</id>
<name>vineetmanohar</name>
<url>http://nexus.vineetmanohar.com/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<distributionManagement>
 <!-- Publish the versioned releases here -->
 <repository>
  <id>vineetmanohar-nexus</id>
  <name>vineetmanohar nexus</name>
  <url>dav:http://nexus.vineetmanohar.com/nexus/content/repositories/releases</url>
 </repository>

 <!-- Publish the versioned releases here -->
 <snapshotRepository>
  <id>vineetmanohar-nexus</id>
  <name>vineetmanohar nexus</name>
  <url>dav:http://nexus.vineetmanohar.com/nexus/content/repositories/snapshots</url>
 </snapshotRepository>
</distributionManagement>

<!-- download artifacts from this repo -->
<repositories>
 <repository>
  <id>vineetmanohar-nexus</id>
  <name>vineetmanohar</name>
  <url>http://nexus.vineetmanohar.com/nexus/content/groups/public</url>
  <releases>
   <enabled>true</enabled>
  </releases>

  <snapshots>
   <enabled>true</enabled>
  </snapshots>
 </repository>
</repositories>

<!-- download plugins from this repo -->
<pluginRepositories>
 <pluginRepository>
  <id>vineetmanohar-nexus</id>
  <name>vineetmanohar</name>
  <url>http://nexus.vineetmanohar.com/nexus/content/groups/public</url>
  <releases>
   <enabled>true</enabled>
  </releases>
  <snapshots>
   <enabled>true</enabled>
  </snapshots>
 </pluginRepository>
</pluginRepositories>

b) settings.xml – If you have disabled anonymous access to Nexus, add the deployment password to your ~/.m2/repository/settings.xml file

<settings>
<servers>
<server>
<!-- this id should match the id of the repo server in pom.xml -->
<id>vineetmanohar-nexus</id>
<username>deployment</username>
<password>password_goes_here</password>
</server>
</servers>
</settings>

 

From http://www.vineetmanohar.com/2010/06/getting-started-with-nexus-maven-repo-manager

Nexus (standard)

Opinions expressed by DZone contributors are their own.

Related

  • Beyond HTTP Handoffs: Build Durable Agent-to-Agent Services With Temporal Nexus
  • Redefining Artifact Storage: Preparing for Tomorrow's Binary Management Needs
  • Publishing MuleSoft Common Assets or Libraries to Anypoint Exchange and Nexus

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook