Publish private jar to nexus

1. Issue an order

mvn deploy:deploy-file -DgroupId=com.huntor -DartifactId=ueditor -Dversion=1.0 -Dpackaging=jar -Dfile=e:\test.jar -Durl=[url] -DrepositoryId=[id]

 2. For example, I need to publish the locally compiled dubbo jar to the private library OSS 3.1.0-04

 2.1 Configure the maven/conf/setting file to increase the server configuration and specify the user name

 

<server>
      <id>deploymentRepo</id>
      <username>admin</username>
      <password>admin123</password>
    </server>

 2.2 cmd Execute the following command (provided that the maven environment has been configured),

   

mvn deploy:deploy-file -DgroupId=com.alibaba -DartifactId=dubbo -Dversion=2.8.4 -Dpackaging=jar -Dfile=E:\dubbo\dubbo-2.8.4.jar -Durl=http://192.168.1.11:8181/repository/maven-releases/thirdparty/ -DrepositoryId=deploymentRepo

 DgroupId and DartifactId constitute the coordinates of the jar package in pom.xml , and the project relies on these two attributes to locate. You can also name yourself.

 

Dfile represents the absolute path of the jar package to be uploaded .

 

The location of the warehouse on the Durl private server, open the nexus- >repositories menu, you can see the path.

DrepositoryId server's representation id , which can be seen in nexus configuration

If the upload is successful, you will see in the cmd window:



 Description of picture parameters

 

2.3 Log in to the private library to see the uploaded jar



 2.4 
At this point, the pop file of the project can be configured as follows, refresh, and the project can get the jar from the private library

<dependency>
    <groupId>com.alibaba</groupId>
    <artifactId>dubbo</artifactId>
    <version>2.8.4</version>
</dependency>

 

Remark:

If maven-releases  in the url is changed to maven-snapshots, an error will be reported, which has not been solved for the time being, and there will be time to improve it later.

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326561468&siteId=291194637