maven deploy时报错

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

pom文件没有配置distributionManagement:

发布仓库一般分为Releases版和snapshot版,所以要配置2个仓库地址 

<distributionManagement>
    <repository>
        <id>nexus-releases</id>
        <name>corp nexus-releases</name>
        <url>http://你的nexusIP:8081/nexus/content/repositories/releases/</url>
    </repository>
    <snapshotRepository>
        <id>nexus-snapshot</id>
        <name>corp nexus-snapshot</name>
        <url>http://你的nexusIP:8081/nexus/content/repositories/snapshots/</url>
    </snapshotRepository>
</distributionManagement>

在setting.xml中添加配置:

<servers>
    <!-- 发布Releases版的账号,ID要与distributionManagement中的Releases ID一致 -->
    <server>
        <id>nexus-releases</id>
        <username>admin</username>
        <password>******</password>
    </server>
    <!-- 发布snapshot版的账号,ID要与distributionManagement中的snapshot ID一致 -->
    <server>
        <id>nexus-snapshot</id>
        <username>admin</username>
        <password>******</password>
    </server>
</servers>

默认密码是 deployment123,也可以自定义密码,然后去Nexus后台修改对应的密码,在登陆后界面左侧Security下的Users下修改密码。其实本人已经配置了上面这些内容,但依然报错的原因其实是我的项目是多模块的,我只在一个模块的pom里配置了distributionManagement,但是我却用另一个模块打包,当然会报错。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值