MYHOSPITALNOW.COM

Find Trusted Doctors & Hospitals

Discover healthcare providers, compare hospitals, and explore treatment options worldwide.

Free Treatment Quotes • Doctor Search • Hospital Comparison

Find Healthcare Options

www.myhospitalnow.com

How to configure Sonatype Nexus repository to download maven dependency?

How to configure Sonatype Nexus repository with Maven?

Automatic dependencies is one of the powerful feature of Apache maven and its one of the reason Maven is very popular in developer community. Maven resolve the dependent library from local repository which is again connected with central repository or remote repository. thus we can say that Maven has 3 kinds of repository concept.
  • Local repostory e.g $USER_HOME/.m2
  • Central repostory e.g http://repo.maven.apache.org/maven2/
  • Private repostory e.g Sonatype Nexus, Artifactory, Archiva etc.
The diagram shown below represent how maven resolve the dependendency.

High Level Interaction between Local Repository, Central Repository and Remote Repository.

Diagram of Maven lookup order: local repository, then central repository, then remote repository
Dependency Management using Local Repository, Central Repository and Remote Repository.
Diagram of dependencies and snapshots flowing between remote repository, internal repository and project classpath
This is How maven interact with Repository!

Diagram of Maven installing to the local repository in ~/.m2/repository and downloading from a remote repository
Diagram of Maven core reading the POM, checking the local repository and fetching from a remote repository over HTTP

This is a diagram which shows the define flow in which maven try to resolve the dependency.

Flowchart of Maven dependency resolution through local, central and remote repositories until found or not

Now, We have understood that Central rrepository is in built but next questions is, How to inform the maven about the location of remote repository? In order to configure maven with remote repostory, in our case SonaType Nexus, we need to configuring host machine setting.xml and projects pom.xml to use your Nexus repos.

Put this in your ~/.m2/settings.xml file. This will configure the credentials to publish to your hosted repos, and will tell your mvn to use your repo as a mirror of central:

Maven settings.xml with Nexus server credentials and a mirror of central pointing to the maven-group URL

And now configure your projects.

If you want only to download dependencies from Nexus, put this in the pom.xml:

Pom.xml repositories section adding the Nexus maven-group repository URL

and

Add the following at the end of setting.xml

<activeProfiles>

    <!–make the profile active all the time –>

    <activeProfile>nexus</activeProfile>

  </activeProfiles>

Reference

https://maven.apache.org/guides/mini/guide-mirror-settings.html

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

Sonatype Nexus Repository Manager: A Practical DevOps Introduction

Sonatype Nexus helps teams centralize dependency downloads and internal artifact publishing. This guide shows how Nexus fits into CI/CD, when to use hosted/proxy/group repos, and how to configure common build clients.

Read More

Nexus Training in India: Course Scope, Hands-On Labs, and Registration Details

This revised guide summarizes the original Nexus training offering, including audience, delivery model, and syllabus topics. It also adds a practical lab workflow and sample Nexus/Maven tasks to help learners prepare.

Read More

Sonar Maven Plugin 1.0-beta-2: What Changed for Archiva/Nexus-Based Builds

This historical release note introduced simpler Sonar Maven Plugin behavior when using repository managers like Archiva or Nexus. Here’s what changed from beta-1, how compatibility works with Sonar versions, and how to validate legacy CI behavior.

Read More

Jenkins Assignment Labs and Exercise

Please submit each assignment with print screen and step by step at www.Debug.School and share a url in Whatsapp Groups Assignment 1: Create a Simple Jenkins Job:…

Read More

How to upload Package to Nexus using jenkins Pipeline

https://support.sonatype.com/hc/en-us/articles/227256688-How-do-I-configure-the-Nexus-Jenkins-Plugin Scripted Pipeline Rajesh Kumar I’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best…

Read More

How to upload the artifacts in Sonatype Nexus using Maven

Step 1 – Install and Configure Nexus Server Step 2 – [Nexus Server] Create a nexus role containing all required access of Nexus. Step 3 – [Nexus…

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
0
Would love your thoughts, please comment.x
()
x