mvn deploy 将本地jar包部署到私服
- 基本命令:
mvn
-X
deploy:deploy-file -Dmaven.test.skip=true -DgroupId=com.qcloud -DartifactId=cos_api -Dversion=5.6.133 -Dpackaging=jar -Dfile=./cos_api-5.6.133.jar -Durl=http://XXX.repositories/thirdparty/ -DrepositoryId=by-release
// -X 表示打印详情,报错信息详情
- 可能出现的问题:
- 本地jar包位置不应该在maven 仓库下面
- 报错信息
-
Caused by: org.apache.maven.plugin.MojoFailureException: Cannot deploy artifact from the local repository: D:\maven\repository\com\qcloud\cos_api\5.6.133\cos_api-5.6.133.jar at org.apache.maven.plugin.deploy.DeployFileMojo.execute (DeployFileMojo.java:283) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
- 解决方法:将jar包迁移到其他文件夹中如 C:/下面
- 上传私服的地址不正确
-
- 报错信息
-
Caused by: org.apache.maven.wagon.TransferFailedException: Failed to transfer file: http://192.168.99.66:8081/nexus/content/repositories/public/com/qcloud/cos_api/5.6.133/cos_api-5.6.133.jar. Return code is: 400, ReasonPhrase: Bad Request.
- 解决方案: 将url 换成host类型的地址
-
-
参考:https://blog.csdn.net/iechenyb/article/details/102613522