gpt4 book ai didi

git - 如何让 Hudson 自动构建和安装发布工件,而不仅仅是快照?

转载 作者:太空狗 更新时间:2023-10-29 14:16:10 25 4
gpt4 key购买 nike

我正在我的笔记本电脑上开发几个 mavenised 项目,并定期推送到 github。我在云中设置了一个私有(private)的 hudson 服务器,用于轮询 git 存储库的更新,从而执行构建 - 到目前为止一切顺利。

不幸的是,当我在笔记本电脑上执行“mvn release:prepare”以执行发布(比如“1.5”)时,发生的两个提交(将 1.5-SNAPSHOT 更改为 1.5,然后将 1.5 更改为 1.6-SNAPSHOT)是一起 push 我的 git repo - 显然 Hudson 构建了最新的一个,即 1.6-SNAPSHOT - 并完全忽略了 1.5 版本。

没关系,但项目相互依赖,我想在我的 poms 中声明非快照版本。然而,当项目 B 依赖于项目 A 的 1.5 版本时,在 Hudson box 上的 hudson 用户的本地 maven 存储库中找不到它 - 因为它从未被构建 - 因此项目 B 的构建失败。

如果我能让 Hudson 更聪明一点,那就太好了,当它看到一个 Maven 发布版本飞过时,强制构建并安装该特定版本,然后再继续构建稍后的快照提交。

我一直在查看 Hudson 插件,尤其是“M2 Release Plugin”:

http://wiki.hudson-ci.org//display/HUDSON/M2+Release+Plugin

-但是,该插件似乎更适合手动选择您想要升级到一些更官方的 Maven Repo 的构建,而不是强制 Hudson 自动构建和安装它遇到的每个发布构建。

更新:我的一些基本需求让我重新思考我想要在这里实现的目标 - 很抱歉没有早点表达它们:

  • 大多数项目都是开源的或打算最终开放,我希望任何人都能够 git clone 任何单个项目, checkout 发布标签,并执行 mvn install 除了 maven central 之外不需要任何其他 repo 依赖。
  • 为了获得一致的结果(在我的笔记本电脑、 hudson 服务器和其他人的 checkout 中),这显然表明我倾向于在我的 poms 中声明非快照依赖项(至少对于发布版本)。
  • 这让我走上了尝试让 Hudson 在它们呼啸而过时“mvn 安装”发布工件的道路,这样以后,Hudson 构建项目 B 就不会在找不到项目 A 的发布版本时失败 (这就是这个问题的来源)

另外:

  • 我使用 sonotype 出色的 oss 托管,它需要 GPG 签名 - 我不想将我的 GPG key 存储在我无法拿在手里的任何硬件上 :) - 所以将它放在 Hudson 服务器上云不是一种选择。
  • 在心理上,让 Hudson 服务器进行发布对我来说有点陌生 - 我真的只是想将它用于 CI。

最佳答案

您现在需要的是实际执行发布。引用 Maven - Guide to using the release plugin :

Performing the release

The plugin will extract file revisions associated with the current release. Maven will compile, test and package the versioned project source code into an artifact. The final deliverable will then be released into an appropriate maven repository.

The release:perform goal will:

  1. Extract file revisions versioned under the new tag name.
  2. Execute the maven build lifecycle on the extracted instance of the project.
  3. Deploy the versioned artifacts to appropriate local and remote repositories.

引用资料

关于git - 如何让 Hudson 自动构建和安装发布工件,而不仅仅是快照?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3971892/

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