maven nexus 3.0后上传jar包方法
程序员文章站
2022-04-04 22:53:38
...
mvn deploy:deploy-file -DgroupId=com.example -DartifactId=demo -Dversion=1.0 -Dpackaging=jar -DrepositoryId=nexus -Dfile=C:\Users\Administrator\Desktop\demo.jar -Durl=http://192.168.59.2:8081/repository/maven-releases/ -DgeneratePom=false
比如:mvn deploy:deploy-file -DgroupId=com.ccb -DartifactId=servlet -Dversion=1.0 -Dpackaging=jar -DrepositoryId=nexus -Dfile=C:\Users\Administrator\Desktop\VerifyAuth.jar -Durl=http://192.168.59.2:8081/repository/maven-releases/ -DgeneratePom=false
这里的nexus对应mvn配置文件里的setting.xml里的
<servers> <!-- server | Specifies the authentication information to use when connecting to a particular server, identified by | a unique name within the system (referred to by the 'id' attribute below). | | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are | used together. | <server> <id>deploymentRepo</id> <username>repouser</username> <password>repopwd</password> </server> --> <!-- Another sample, using keys to authenticate. <server> <id>siteServer</id> <privateKey>/path/to/private/key</privateKey> <passphrase>optional; leave empty if not used.</passphrase> </server> --> <server> <id>nexus</id> <username>admin</username> <password>123456</password> </server> </servers>
实在不行可以pom.xml里用compile插件,引入jar包 <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <encoding>UTF-8</encoding> <compilerArguments> <extdirs>src/main/lib</extdirs> </compilerArguments> </configuration> </plugin>
如果要指定settings.xml
mvn -s D:\app\apache-maven-3.2.3\conf\settings.xml deploy:deploy-file -DgroupId=com.abc.pay -DartifactId=client -Dversion=3.1.1 -Dpackaging=jar -Dfile=C:\Users\dongsw\Desktop\client-3.1.1.jar -Durl=http://192.168.59.240:8081/repository/maven-releases/ -DrepositoryId=releases
示例
mvn -s C:\Users\Administrator\.m2\settings.xml deploy:deploy-file -DgroupId=com.websocket.goeasy -Durl=http://maven.sxb.lol/repository/maven-releases/ -DartifactId=goeasy-sdk -Dversion=1.0.0 -Dpackaging=jar -Dfile=C:\Users\Administrator\Desktop\goeasy-sdk-0.3.5.jar -DrepositoryId=releases -X
注意-DrepositoryId=release跟server的id一致