Deploy the jar package to the remote MAVEN repository

Source: Internet
Author: User

When using MAVEN to develop a project, module A may be dependent on module B's Jar package, and if two modules are in a project, simply add the dependency information of Module B to module A's pom file, and module A can load Module B's Jar package. However, if module A and Module B are in different projects or even developed by different engineers, then you need to deploy module B to the remote repository, and module A can download the jar package for module B by configuring the address of the remote repository in the Pom file.

There are usually two types of remote warehouses that are allowed to be uploaded: snapshots and releases, respectively, the snapshot and stable warehouses. The snapshot version of the warehouse is used to store the unstable development package, and the stable version of the warehouse is used for stable packages.

Configure the following in the local maven settings.xml:

<Server>  <ID>Snapshots</ID>  <username>Your user name</username>  <Password>Your password.</Password></Server> <Server>  <ID>Releases</ID>  <username>Your user name</username>  <Password>Your password.</Password></Server>

Open cmd and position it to the folder of the jar package you want to upload, like enter the following command:

MVN deploy:deploy-file -dgroupid=com.test-dartifactid=service-api-dversion=2.5. 0-snapshot-dpacckaging=jar-dfile=service-api-2.5. 0-snapshot.jar-drepositoryid=snapshots-durl=http://www.hello.com:8787/archiva/ Repository/snapshots

Note that –dversion,-drepositoryid,-durl are corresponding, such as the version is snapshot, the warehouse ID should also be the ID of the snapshot warehouse, warehouse address also need to fill in the URL of the snapshot warehouse.
If the cmd current path and the path of the jar package are in the same folder,-dfile writes the file name directly, if it is not in the same directory, you need to write the absolute path of the file after-dfile.

Deploy the jar package to the remote MAVEN repository

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.