通过 Hudson 发布 Maven

发布于 2024-07-19 00:50:30 字数 205 浏览 5 评论 0原文

我正在设置 Hudson 使用批处理任务插件将 Maven 发布到我们的内部存储库。 我这样做的方式是:

mvn --batch-mode release:prepare
mvn --batch-mode release:perform

我对人们使用过的其他方法以及这些方法的优缺点感兴趣。 另外,人们遇到过的任何问题。

I'm setting up Hudson to use the batch-task plugin to do maven releases to our internal repository. I'm doing it via:

mvn --batch-mode release:prepare
mvn --batch-mode release:perform

I'm interested in other methods people have used and the pros and cons of those methods. Also, any gotchas people have come across.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

在你怀里撒娇 2024-07-26 00:50:30

由于一些原因,我倾向于总是手动进行发布。 首先,如果您必须回滚,那么当您可以返回到原始发布位置并执行此操作时会更容易。 其次,因为您需要在此过程中解决所有快照依赖性。

我们的开发过程让我们将依赖关系保留在先前发布版本的当前构建之外,直到修复需要升级。 这意味着如果我要发布 Nexus、Maven 等,那么我会看到快照,这意味着我必须先发布它们。 此过程实际上不可能自动化,因为它会根据自上次版本以来的更改而变化。

也就是说,我们有一台专门用于构建的特殊机器(在 Sonatype 中它只是一个虚拟机)。 这样做是为了保证不会发生可能意外影响构建的环境变化(例如 jdk 更改)。 它还使任何人都可以更轻松地掌握发布过程,因为它始终准备就绪。

I have tended to do the releases always by hand for a few reasons. First if you have to roll back it's easier when you can go back to the original release location and do it. Secondly because you need to resolve all snapshot dependencies as part of the process.

Our development process has us leaving dependencies external to the current build at the previous release version until a fix requires an upgrade. This means that if I'm releasing Nexus, Maven, etc, then I see snapshots and it means I have to go off and release those first. This process isn't really possible to automate since it varies based on what's changed since the last release.

That said, we have a special machine (at Sonatype it's just a vm) setup only for builds. This is done to guarantee no environmental changes occur that could influence a build accidentally (like a jdk change). It also makes it easier for anyone to pick up the release process because it's always ready to go.

命比纸薄 2024-07-26 00:50:30

最近,一个 m2release 插件引起了我的注意。 看起来不错。 尽管如此,我希望我的发布过程完全“无需 pom 调整”。 我的意思是,我们必须提供 4 个输入参数来处理完整的发布:

  1. 发布版本(例如 1.0.0)
  2. 新的开发版本(例如 1.0.1-SNAPSHOT)
  3. SCM 中的发布标签(例如.release-1.0.0 或 1.0.0)
  4. SCM 中的标记基本路径

前 2 个具有可接受的默认值。 版本冲突在错误修复版本数字上对我来说完全没问题。

数字 4 可以在 pom.xml 中指定。 它不会改变。

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-release-plugin</artifactId>
    <configuration>
        <tagBase>https://example.com/svn/myProject/releases</tagBase>
    </configuration>
</plugin>

这是第三个阻碍我通过按下按钮完全自动化发布的问题。 默认的发布标签不会为我们做这件事,所以我们必须指定它:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-release-plugin</artifactId>
    <configuration>
        <tag>release-${pom.version}</tag>
        <tagBase>https://example.com/svn/myProject/releases</tagBase>
    </configuration>
</plugin>

现在,虽然这可能正是我所需要的,但我最终得到了一个末尾带有 -SNAPSHOT 的 svn 标签。 :( 所以我必须在 Hudson 作业配置中传递 tag 参数。此外,我必须为我们制作的每个版本更改它......这不完全是我需要的。


所以,最后,有一个 maven2 类型hudson 中的项目 + m2release hudson 插件 + 正确配置的 maven 发布插件是我迄今为止看到的所有发布过程的母亲,虽然并不完美,但它为我节省了很多繁琐的工作

Recently, a m2release plugin came to my attention. Seemed nice. Althought, I would have liked my release process to be completely «pom-tweaking-free». What I mean by that is that we have to provide 4 input parameter to process a complete release:

  1. the release version (ex. 1.0.0)
  2. the new development version (ex. 1.0.1-SNAPSHOT)
  3. the release tag in SCM (ex. release-1.0.0 or 1.0.0)
  4. the tag base path in SCM

The first 2 have acceptable defaults. The version bumping at the bug-fix version digit is perfectly fine for me.

Number 4 can be specified in the pom. It won't change.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-release-plugin</artifactId>
    <configuration>
        <tagBase>https://example.com/svn/myProject/releases</tagBase>
    </configuration>
</plugin>

It's the third one that prevent me from a complete automation of a release at the push of a button. The default release tag label won't do it for us so we have to specify it:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-release-plugin</artifactId>
    <configuration>
        <tag>release-${pom.version}</tag>
        <tagBase>https://example.com/svn/myProject/releases</tagBase>
    </configuration>
</plugin>

Now, while this might be just what I needed, I end up having a svn tag with the -SNAPSHOT at the end. :( So I have to pass the tag parameter in the Hudson job configuration. Furthermore, I have to go change it for each release we make ... which is not exactly what I need.


So, in the end, having a maven2 type project in hudson + the m2release hudson plugin + the maven release plugin correctly configured is the Mother of all the release process I've seen so far. While not perfect, it saved me a lot tiedous work.

JS.

泡沫很甜 2024-07-26 00:50:30

我总是手动触发发布,优点和缺点都很明显:-)

I've always triggered a release manually with obvious pros and cons :-)

苏辞 2024-07-26 00:50:30

我们一直在尝试使用 Hudson Maven 发布插件,尽管我在让它正确地信任发布版本方面遇到了一些挑战,而没有像将密码硬编码到我们的构建文件中这样的邪恶事情。

We've been experimenting with the Hudson Maven release plugin, though I'm a bit challenged with getting it to properly credit the releases, without evil things like hardcoding passwords into our build files.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文