Most of the artifacts my come from Maven Central (Apache, etc) but there are times when you want to create your own in house Maven repository that all the developers have access too,
When Maven has to resolve an artifact it follows below
You can setup repositories and repository mirrors (that may be closer to your location) using eithre directory in the POM file (project specific) or use the settings.xml file (global for all projects).
The repository property has a number of properties that you can define
Setting up a mirror to Maven Central, first you need to open up the settings.xml, do this by right-clicking on the POM file and select maven -> open settings.xml
Once opened we can add the mirror property
Setting up a Specific Respoitory
There are many repositories on the web like JBoss, Oracle, Sonatype, Spring, etc to setup a specific repository you need to add a repositories property to the POM file, below we add the RedHat repository
If you take a look at the effective POM you can see that its added the additional repository, we have both Maven Central and RedHat.
There are two settings files
There are a number of properties you can use in the settings file
To setup a server with an encrypted password we first must setup the master password using the mvn --encrypt-master-password <password> command then creating a settings-security.xml and adding this password to the <settingsSecurity> property and then use the mvn ---encrypt-password <password> command to create the password for the server.
![]() |
![]() |