轉自http://www.lxweimin.com/p/95c72f33d580
命令方式上傳jar包到maven倉庫(本地 & nexus私服)
1.傳到本地
mvn install:install-file -DgroupId=com.xxx.xxx? ?-DartifactId=xxx? ?-Dversion=1.0 -Dpackaging=jar -Dfile=[path to file]?
2.傳到nexus
mvn deploy:deploy-file-DgroupId=com.xxx.xxx-DartifactId=xxx? ?-Dversion=1.0-Dpackaging=jar? ?-Dfile=[path to file]? ?-Durl=[url]? ? ?-DrepositoryId=[id]
配合本地maven下的setting.xml需要設置server及用戶名和密碼等信息,groupId、artifactId、version等屬性即為jar包的坐標信息,用戶自定義的,file屬性就是jar包在本地的路徑,url就是要傳到的私服的倉庫地址,repositoryId的值是在setttings.xml里的server下對應的id。
3.demo:
mvn install:install-file -DgroupId=com.xxx.operation -DartifactId=optLog-test -Dversion=1.0.0? -Dfile=D:\workcode\common\log\target\log-0.0.1-SNAPSHOT.jar
mvn deploy:deploy-file -DgroupId=com.xxx.operation -DartifactId=optLog-test -Dversion=1.0.0-RELEASE -Dpackaging=jar -Dfile=D:\workcode\common\log\target\log-0.0.1-SNAPSHOT.jar -Durl=http://xxx.xxx.xxx.xxx:8081/nexus/content/repositories/thirdparty/ -DrepositoryId=maven-releases