java - altDeploymentRepository 和 altReleaseDeploymentRepository ,distributionManagement 之间的区别

 <!--定义snapshots库和releases库的nexus地址-->
    <distributionManagement>
        <repository>
            <id>rdc-releases</id>
            <url>https://repo.rdc.aliyun.com/repository/33566-release-BheiIK/</url>
        </repository>
<!--        <repository>-->
<!--            <id>2138699-release-xv0wqi</id>-->
<!--            <url>https://packages.aliyun.com/maven/repository/2138699-release-xv0wqi/</url>-->
<!--        </repository>-->
        <snapshotRepository>
            <id>rdc-snapshots</id><!--对应setting.xml里面的server节点下的serverid-->
            <url>https://repo.rdc.aliyun.com/repository/33566-snapshot-EE05gc/</url>
        </snapshotRepository>
<!--        <snapshotRepository>-->
<!--            <id>2138699-snapshot-yeXAwF</id>-->
<!--            <url>https://packages.aliyun.com/maven/repository/2138699-snapshot-yeXAwF/</url>-->
<!--        </snapshotRepository>-->
    </distributionManagement>

我使用 swagger 在我的项目中生成 Web 服务客户端。生成的代码生成一个可以用作 Maven 库的库。我已经成功地将发布版本部署到我的私有 (private) sonatype-nexus 中。

我想知道 altDeploymentRepository 和 altReleaseDeploymentRepository 有什么区别?如果设置了这两个参数,mvn deploy 如何选择要使用的存储库?

作为 apache-maven deploy documentation 说:

altDeploymentRepository: Specifies an alternative repository to which the project artifacts should be deployed ( other than those specified in ). Format: id::layout::url

altReleaseDeploymentRepository: The alternative repository to use when the project has a final version.

altSnapshotDeploymentRepository: The alternative repository to use when the project has a snapshot version.

具体是做什么的

when the project has a final version.

是什么意思?

最佳答案

当 altReleaseDeploymentRepository 被指定,当项目有发布 (或 “最终”) 版本时总是使用它,即不是快照版本。当 altSnapshotDeploymentRepository 被指定,它总是在项目有快照版本时使用。 altDeploymentRepository 当没有指定或使用上述存储库时,是默认的备用部署存储库。

所以换句话说,如果你有一个发布版本,那么:

  • altReleaseDeploymentRepository 将在指定时使用;
  • 否则 altDeploymentRepository 将在指定时使用;
  • 否则发布在 <distributionManagement><repository> 中声明的远程仓库如果指定,将使用 POM 元素;
  • 否则插件会出错,因为它没有找到任何要部署到的远程存储库。

同样,如果你有一个快照版本,那么:

  • altSnapshotDeploymentRepository 将在指定时使用;
  • 否则 altDeploymentRepository 将在指定时使用;
  • 否则在 <distributionManagement><snapshotRepository> 中声明的快照远程存储库如果指定,将使用 POM 元素;
  • 否则发布在 <distributionManagement><repository> 中声明的远程仓库如果指定,将使用 POM 元素;
  • 否则插件会出错,因为它没有找到任何要部署到的远程存储库。

https://stackoverflow.com/questions/41611671/difference-between-altdeploymentrepository-and-altreleasedeploymentrepository

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值