maven last jar package to private server

1. Upload the jar package,
2. The project team uploads the jar package
(1) Modify the authentication part of the local settings.xml file
  <servers>       
          <!--Select the upload type according to the situation-->
          <!--Stable version configuration-->
       <server>
         <id>releases</id>
         <username>soa account</username>
         <password>soa password</password>
       </server>
          <!--snapshots-->
       <server>
         <id>snapshots< /id>
         <username>soa account</username>
         <password>soa password</password>
       </server> 
  </servers>

①deploy releases
mvn deploy:deploy-file -DgroupId=XXX -DartifactId=XXX -Dversion=XXX -Dpackaging=jar -Dfile=XXX.jar -Durl=http://maven.cnsuning.com/content/repositories/releases/ -DrepositoryId= releases
②deploy snapshots version
mvn deploy:deploy-file -DgroupId=XXX -DartifactId=XXX -Dversion=XXX -Dpackaging=jar -Dfile=XXX.jar -Durl=http://maven.cnsuning.com/content/repositories/snapshots / -DrepositoryId=snapshots
(3) For special cases:
When distinguishing packages compiled from the same pom but with different contents, but with the same groupId, artifactId, and version, the classifier parameter needs to be used. The command is as follows
mvn deploy:deploy-file -DgroupId=XXX -DartifactId=XXX -Dversion=XXX -Dclassifier=XXX -Dpackaging=jar -Dfile=XXX.jar -Durl=http://maven.baidu.com/content/repositories /releases/ -DrepositoryId=releases
For example, uploading sources and pom.xml can refer to the following:
mvn deploy:deploy-file -DgroupId=XXX -DartifactId=XXX -Dversion=XXX-SNAPSHOT -Dpackaging=jar -Dclassifier=sources -Dfile=scts-invoke-sncd-sources.jar -Durl=http://maven.baidu .com/content/repositories/snapshots/ -DrepositoryId=snapshots

mvn deploy:deploy-file -DgroupId=XXX -DartifactId=XXX -Dversion=XXX -Dpackaging=pom -Dfile=pom.xml -Durl=http://maven. baidu.com/content/repositories/releases/ -DrepositoryId=releases
Second, upload precautions
1.snapshots version: When uploading, it must be: -Dversion=version number-SNAPSHOT. The above two versions are uploaded according to the actual situation, not all of them need to be uploaded.
2. Related parameters:
-Durl refers to the path to deploy to the warehouse
-DrepositoryId The repositoryid of the jar package, that is, releases or snapshots
-Dfile The specific path of the jar package refers to the absolute path, such as: D:/test/test.jar
-Dversion jar version
-Dclassifier is used to distinguish packages of the same name compiled from the same pom but with different contents. For example, the same project compiles two artifacts, one supports jdk1.5 and the other supports jdk1.4, then you can use this to name jdk15 and jdk14 to distinguish, if it appears in the package name, then it must follow the version number. There is also a case where some secondary artifacts of a project are attached to the main artifact, and this can be used to distinguish them. For example, if a project generates three kinds of things: source, javadoc, and class, then different classifiers can be used to identify these respectively. thing.
3. Upload error:
When executing this command, sometimes I see a prompt that a POM file is required, but the upload package does not require a pom file.
The biggest possibility is that your statement is wrong, such as an extra space and a newline, so that the statement is directly truncated to the front of the newline, and cmd finds a statement it can recognize to execute, such as directly executing mvn, and mvn is to package the project, and it needs a pom file. of.
So please be patient and recheck the command.
Note: Generally speaking, when the upload error is 401forbidden, it is due to the wrong configuration of the library ID in the maven configuration file. Please check carefully.
Please copy the maven configuration file setting.xml to C:\Users\job number\.m2 to make sure it is correct.

In the case of confirming that you have permission, an error 403 is still reported, which means the password is incorrect. If the confirmed password is soa's password, please contact the administrator.
Don't worry about the students who reported 400 errors, because there is an identical package in the maven library, and it is not allowed to overwrite, so it is 400. Please update the version number and upload it again!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326535837&siteId=291194637