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
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workkloads.

Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Redefining Artifact Storage: Preparing for Tomorrow's Binary Management Needs
  • Publishing MuleSoft Common Assets or Libraries to Anypoint Exchange and Nexus
  • How to Publish Docker Images on Private Nexus Repository Using Jib Maven Plugin
  • How to Publish Docker Images on a Private Nexus Repository Using Jib Maven Plugin

Trending

  • From Fragmentation to Focus: A Data-First, Team-First Framework for Platform-Driven Organizations
  • Key Considerations in Cross-Model Migration
  • Unlocking the Potential of Apache Iceberg: A Comprehensive Analysis
  • CRDTs Explained: How Conflict-Free Replicated Data Types Work
  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 user avatar
Vineet Manohar
·
Jun. 07, 10 · Interview
Likes (3)
Comment
Save
Tweet
Share
104.4K Views

Join the DZone community and get the full member experience.

Join For Free

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

  • Redefining Artifact Storage: Preparing for Tomorrow's Binary Management Needs
  • Publishing MuleSoft Common Assets or Libraries to Anypoint Exchange and Nexus
  • How to Publish Docker Images on Private Nexus Repository Using Jib Maven Plugin
  • How to Publish Docker Images on a Private Nexus Repository Using Jib Maven Plugin

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

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 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!