打开cmd命令提示符,mvn install是将jar包安装到本地库,mvn deploy是将jar包上传到远程server,install和deploy都会先自行bulid编译检查,如果确认jar包没有问题,可以使用-Dmaven.test.skip=true参数跳过编译和测试。 
全命令为:

mvn deploy:deploy-file -Dmaven.test.skip=true -Dfile=D:\work\scan\com.kevin.skeleton\target\skeleton-1.0.jar -DgroupId=hessian -DartifactId=skeleton -Dversion=1.0 -Dpackaging=jar -DrepositoryId=releases -Durl=http://192.168.0.202:8080/nexus/content/repositories/releases

  1. mvn deploy:deploy-file -Dmaven.test.skip=true -Dfile=D:\MvnProject\service-mvn-1.0.0.jar -DgroupId=pri.roy.mvn.test -DartifactId=mvn-api -Dversion=1.0.0-SNAPSHOT -Dpackaging=jar -DrepositoryId=roy_privrepository_snapshots -Durl=http://10.4.71.144:9090/repository/roy_privrepository_snapshots/
  2. 1
  1. -Dmaven.test.skip=true                              //跳过编译、测试
  2. -Dfile=D:\MvnProject\service-mvn-1.0.0.jar          //jar包文件地址,绝对路径
  3. -DgroupId=pri.roy.mvn.test                          //gruopId--pom坐标,自定义
  4. -DartifactId=mvn-api                                //artifactId--pom坐标,自定义
  5. -Dversion                                           //版本号
  6. -Dpackaging                                         //打包方式
  7. -DrepositoryId                                      //远程库服务器ID
  8. -Durl                                               //远程库服务器地址

如:

  1. mvn deploy:deploy-file -DgroupId=com.alipay -DartifactId=alipay-sdk-java -Dversion=20170725114550 -Dpackaging=jar
  2.  -Dfile=D:\com\alipay\alipay-sdk-java\20170725114550\alipay-sdk-java-20170725114550.jar -Durl=http://XXXXXXXXX:8081/repository/obanks-releases/ -DrepositoryId=obanks-releases
  1. <dependency>
  2.   <groupId>com.alipay</groupId>
  3.   <artifactId>alipay-sdk-java</artifactId>
  4.   <version>20170725114550</version>
  5. </dependency>

 image.png