maven发布报错:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project maven_web

这篇博客讲述了在使用Maven构建项目并尝试发布Jar包时遇到的问题。由于在父工程及子工程的POM配置中缺失了`distributionManagement`部分,导致部署失败。解决方案是添加正确的repository和snapshotRepository元素,确保与远程仓库的URL匹配。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

maven发布jar包时就最后的controller没有通过

[INFO] parent ............................................. SUCCESS [  1.990 s]
[INFO] maven_pojo ......................................... SUCCESS [  2.011 s]
[INFO] maven_dao .......................................... SUCCESS [  0.958 s]
[INFO] maven_service ...................................... SUCCESS [  0.823 s]
[INFO] maven_web Maven Webapp ............................. FAILURE [  1.247 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------

报以下错误:

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

主要原因是pom配置错误

1.在父工程的pom中没有配置以下代码

    <distributionManagement>
        <repository>
            <id>xxx-release</id>
            <url>http://localhost:8081/repository/xxx-release/</url>
        </repository>

        <snapshotRepository>
            <id>xxx-snapshots</id>
            <url>http://localhost:8081/repository/xxx-snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

2.我的报错在maven_web中。仔细检查过后发现是没有在子工程maven_web的pom中配置对应父工程的代码

  <!--指定父工程是那个-->
  <parent>
    <artifactId>parent</artifactId>
    <groupId>org.example</groupId>
    <version>1.0-SNAPSHOT</version>
  </parent>

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值