gpt4 book ai didi

java - 更新 Maven 项目模块中的父版本

转载 作者:搜寻专家 更新时间:2023-10-31 19:37:12 25 4
gpt4 key购买 nike

我有一个奇怪的场景,我有一个项目“Y”,它有一个模块“X”和一些其他模块。

X 是项目 Y 的一部分,但它没有作为该项目的模块链接。因此,每次发布新版本的 Y 时,都需要手动更新 X 中的父版本。

我需要按以下方式更新 Y 项目:a) 每次发布 Y 项目时,X 中的父项目版本应由 TeamCity 自动更新(以与其他模块类似的方式)

b)X 不能是 Y 分布的一部分

c)一旦部署在 TeamCity 中,它就不应该从 X 运行测试(它们应该与集成测试和发布构建一起运行)

最佳答案

versions:update-parent

如果您在项目 X 的根目录下打开一个终端,您可以使用 versions:update-parent 将其父版本更新为 最新:

$ mvn versions:update-parent -DallowSnapshots=true

您可以从 TeamCity 执行此命令,然后将更改提交到 pom。这当然可以在构建 Y 时触发,您甚至可以提供版本(它必须是 listrange):

$ mvn versions:update-parent -DparentVersion=[1.0.0,1.0.1]    //or [1.0.0,1.5.0)

文档

参见 versions-maven-plugin的文档,尤其是:

  • versions:update-parent

updates the parent section of a project so that it references the newest available version. For example, if you use a corporate root POM, this goal can be helpful if you need to ensure you are using the latest version of the corporate root POM.

  • versions:set

can be used to set the project version from the command line.

  • 版本:提交

removes the pom.xml.versionsBackup

  • versions:update-child-modules

updates the parent section of the child modules of a project so the version matches the version of the current project. For example, if you have an aggregator pom that is also the parent for the projects that it aggregates and the children and parent versions get out of sync, this mojo can help fix the versions of the child modules. (Note you may need to invoke Maven with the -N option in order to run this goal if your project is broken so badly that it cannot build because of the version mis-match).

关于java - 更新 Maven 项目模块中的父版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39449275/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com