从 SVN 标签在 Maven 中构建项目

发布于 2024-12-17 04:46:29 字数 749 浏览 6 评论 0原文

我们目前使用 Maven (v2.2.1) 来管理我们的 Java 项目,包括使用release:prepare 和release:perform 来对我们的版本进行版本控制。

虽然这一切都非常简单,但我发现自己需要从以前的版本生成构建工件 - 是否可以让 Maven 签出给定的 (svn) 标签,并从该版本构建工件?

IE。我在 SVN 中的项目有以下标签:

  • project-1.0.0project
  • -1.0.1project
  • -1.1.0

我想构建“project-1.0.1”(或者实际上该项目中的任何标签)。

编辑:

为了澄清我想要做什么,请考虑 release:preparerelease:perform 目标。

:prepare:perform 期间,Maven 会询问此版本应使用什么 SCM 标签,然后创建该标签,将该标签的源代码检出到一个单独的目录中以便为您的项目生成某种洁净室版本。

我想做的是实际上执行最后一部分,由此 I 提供 SCM 标签(在命令行上,而不是在 pom 中对其进行硬编码,因为那样不是特别灵活), Maven 很高兴地去检查代码并执行洁净室构建,从而产生最终的构建工件,其方式与 release:perform 完全相同。

We currently use Maven (v2.2.1) to manage our Java projects, including using release:prepare and release:perform to version our releases.

While this is all pretty simple, I find myself needing to produce the build artifacts from a previous release - is it possible to have maven checkout a given (svn) tag, and build the artifacts from that version?

ie. I have the following tags for a project in SVN:

  • project-1.0.0
  • project-1.0.1
  • project-1.1.0

I would like to build 'project-1.0.1' (or in fact any tag from that project).

Edit:

In order to clarify what I'm trying to do, consider the release:prepare and release:perform goals.

During :prepare and :perform Maven asks what SCM tag should be used for this release, and afterwards creates the tag, checks out the source for this tag into a separate directory in order to produce a sort of cleanroom build of your project.

What I would like to do is actually perform this last part, whereby I supply the SCM tag (on the command line, rather than hard coding it in the pom, as that would not be particularly flexible), and Maven happily goes off to checkout the code and perform a cleanroom build, resulting in the final build artifact, in exactly the same way as release:perform.

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

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

发布评论

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

评论(1

一身骄傲 2024-12-24 04:46:29

您可能需要查看使用 引导项目 a href="http://maven.apache.org/scm/plugins/index.html" rel="nofollow">maven scm 插件。

通过定义一个 pom,其中包含具有指定标签的 scm 配置以及所需的 Maven 目标,您可以签出您选择的标签并构建相同的标签。

该链接包含示例配置。

You may want to look at bootstrapping a project using maven scm plugin.

By defining a pom, which contains your scm configuration with the specified tag, as well as the desired maven goal, you can checkout a tag of your choice and build the same.

The link contains an example configuration.

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