Deploying Artifacts to Nexus
Different organizations have different reasons for deploying artifacts to an internal repository. In large organizations with hundreds (or thousands) of developers, an internal Maven repository can be an efficient way for different departments to share releases and development snapshots with one another. Most organizations that use Maven will eventually want to start deploying both releases and artifacts to a shared, internal repository. Using Nexus, it is easy to deploy artifacts to Nexus hosted repositories.
To deploy artifacts to Nexus, supply the repository
URL in distributionManagement
and run mvn deploy. Maven will push
project POMs and artifacts to your Nexus
installation with a simple HTTP PUT. No extra wagon
extension is needed in your projectâs POM. Nexus
works with Mavenâs built-in
wagon-http-lightweight
.
Configuring Deployment Security
Nexus ships with a deployment user that has a default password
of deployment123
. For this chapter, weâll assume
that you are using the default deployment password. To configure
Maven to deploy to Nexus, add the following server elements to your
~/.m2/settings.xml file:
<settings> ... <servers> <server> <id>releases</id> <username>deployment</username> <password>deployment123</password> </server> <server> <id>snapshots</id> <username>deployment</username> <password>deployment123</password> </server> <server> <id>thirdparty</id> <username>deployment</username> <password>deployment123</password> </server> </servers> ...
Get Maven: The Definitive Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.