How Maven publishes the jar package to the Nexus private library

Source: Internet
Author: User

Nexus2 can upload jar packages to private libraries through the admin interface, but the newest NEXUS3 can't find the upload interface and can only be published to private libraries in the following ways.

Publishing third-party jar packages

In this case, the MAVEN remote repository does not have a local third-party jar package that needs to be published to the private library.

mvn deploy:deploy-file   -DgroupId=com.example  -DartifactId=test  -Dversion=0.0.1  -Dpackaging=jar  -Dfile=E:\workspace\test\WebRoot\WEB-INF\lib\test-0.0.1.jar  -Durl=http://nexus.example.com:8081/repository/3rd-repo/  -DrepositoryId=Nexus

Note that the file directory cannot be the same as the local repository directory, or it will be an error.

Publish your own project

The company's own projects need to be published to the Nexus Private library for other people to rely on, then can be used in the above way to make a jar package and then release, you can also use Maven's eclipse plugin.

Add maven POM Configuration:

<distributionManagement>    <repository>        <id>Nexus</id>        <name>Releases</name>        <url>http://nexus.example.com:8081/repository/maven-releases</url>    </repository>    <snapshotRepository>        <id>Nexus</id>        <name>Snapshot</name>        <url>http://nexus.example.com:8081/repository/maven-snapshots</url>    </snapshotRepository></distributionManagement>

Then use Run as on the Eclipse project. >maven build: In goals, enter deploy to release.

Maven Settings configuration

Above two points where Nexus refers to the MAVEN server ID, case sensitive, adds the following configuration.

<servers>    <server><id>Nexus</id>      <username>admin</username>      <password>admin123</password>    </server>    </servers>

The use of Maven and the construction of the private library can be browsed through the previous Maven collection of articles.

How Maven publishes the jar package to the Nexus private library

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.