0
点赞
收藏
分享

微信扫一扫

Deployment failed: repository element was not specified in the POM inside distributionManagement(已解决


背景

最近在整理公司CI/CD的文档,拉了个公司别人写的java-demo, 结果mvn deploy失败了,具体异常如下:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project docker-java-app-example: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]

Deployment failed: repository element was not specified in the POM inside distributionManagement(已解决_maven

原因分析

我们执行mvn deploy命令,是想将maven所打的jar包上传到远程的repository;pom里通过​​distributionManagement​​设置私服地址,那怎么上传到私服呢??

所以解决方案如下:

解决方案

在项目下的pom文件里增加私服配置​​<distributionManagement>​​:

<distributionManagement>
<repository>
<id>随便起</id>
<url>自己maven环境下setting文件里面的私有库</url>
</repository>
<snapshotRepository>
<id>随便起</id>
<url>自己maven环境下setting文件里面的快照库</url>
</snapshotRepository>
</distributionManagement>

配置完之后再重新depoly,就BUILD SUCCESS了。

示例

POM文件内容:

Deployment failed: repository element was not specified in the POM inside distributionManagement(已解决_java_02

mvn deploy结果:

Deployment failed: repository element was not specified in the POM inside distributionManagement(已解决_解决方案_03


举报

相关推荐

0 条评论