gpt4 book ai didi

maven-2 - 发布时替换pom中的-SNAPSHOT

转载 作者:行者123 更新时间:2023-12-02 21:31:28 25 4
gpt4 key购买 nike

我正在与我的开发团队一起积极开发代码。当我们向客户发布时,我想提供不带 -SNAPSHOT 的 jar,这样他们只需要在创建新的点版本时进行更新。

这里有一个 Maven 插件提供此功能。我知道这是因为其他人都必须以某种方式做到这一点。我怀疑是手动的。

我希望答案尽可能明确。

请并谢谢您。

最佳答案

一些插件可以在这里提供帮助,正如 this answer 中已经提到的那样并在 the comments of this one :Maven Release Plugin如果您想完全自动化发布和/或 Maven Versions Plugin

使用 Maven 发布插件

使用 Maven Release Plugin 发布项目分两步完成:prepareperform这是文档中关于 release:prepare 的内容目标:

Preparing a release goes through the following release phases:

  • Check that there are no uncommitted changes in the sources
  • Check that there are no SNAPSHOT dependencies
  • Change the version in the POMs from x-SNAPSHOT to a new version (you will be prompted for the versions to use)
  • Transform the SCM information in the POM to include the final destination of the tag
  • Run the project tests against the modified POMs to confirm everything is in working order
  • Commit the modified POMs
  • Tag the code in the SCM with a version name (this will be prompted for)
  • Bump the version in the POMs to a new value y-SNAPSHOT (these values will also be prompted for)
  • Commit the modified POMs

换句话说,Maven Release Plugin 正是按照您的要求进行的。

使用 Maven 版本插件

如果您不使用 Maven 发布插件, Maven Versions 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: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).
  • versions:set can be used to set the project version from the command line.
  • versions:commit removes the pom.xml.versionsBackup files. Forms one half of the built-in "Poor Man's SCM".
  • versions:revert restores the pom.xml files from the pom.xml.versionsBackup files. Forms one half of the built-in "Poor Man's SCM".

我提到了几个目标,但“最”有趣的可能是这里的 versions:update-child-modules 。它将允许更改顶级父 pom 中的版本,然后自动更新子项。请参阅Fixing a multi-module build举个例子。

无法提供更多帮助,您现在需要自己进行实验。祝你好运!

引用文献

关于maven-2 - 发布时替换pom中的-SNAPSHOT,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3688860/

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