当您使用 git 时,Maven pom.xml - <scm> 内的 <tag> 元素的用途是什么

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23718601/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 10:02:30  来源:igfitidea点击:

What is the usage of Maven pom.xml - <tag> element inside of <scm> when you are using git

gitmavenmaven-scm

提问by mjlee

We are using maven and git together for a Java project. In <scm>section, <tag>is automatically added by release plugin.

我们正在将 maven 和 git 一起用于 Java 项目。在<scm>节中,<tag>由发布插件自动添加。

For example,

例如,

  <scm>
          <connection>scm:git:http://myserver:7990/scm/project/test.git</connection>
          <tag>releaes-tag</tag>
  </scm>

What does <tag>represent here?

<tag>这里代表什么?

I believe the normal convention is <tag>HEAD</tag>.

我相信正常的约定是 <tag>HEAD</tag>.

When we were using subversion, maven never used <tag></tag>

当我们使用 subversion 时,maven 从未使用过 <tag></tag>

What is the meaning of <tag></tag>?

是什么意思<tag></tag>

I searched google and maven documentation but I cannot find any information on it.

我搜索了 google 和 maven 文档,但找不到任何相关信息。

采纳答案by Joe

The <tag>element is used by release:prepareto specify the tag that was created for this release (implemented as MRELEASE-723). Outside of a release it is essentially a placeholder, and HEADis an appropriate value.

<tag>元素用于release:prepare指定为此版本创建的标记(实现为MRELEASE-723)。在发布之外,它本质上是一个占位符,并且HEAD是一个合适的值。

When we were using subversion, maven never used <tag></tag>

当我们使用 subversion 时,maven 从未使用过 <tag></tag>

As MRELEASE-723explains:

正如MRELEASE-723解释:

when I invoke release:prepare with a URL like: https://example.test/svn/REPO/myproject/branches/releaseit will be replaced by https://example.test/svn/REPO/myproject/tags/myproject-1.0which is fine because now you know which revision to checkout for building the release.

当我使用如下 URL 调用 release:prepare 时: https://example.test/svn/REPO/myproject/branches/release它将被替换为https://example.test/svn/REPO/myproject/tags/myproject-1.0which 很好,因为现在您知道要检出哪个修订版以构建发布。

The <scm>element for a release build should contain enough information to check out the tag that was created for this release.

<scm>发布版本的元素应该包含足够的信息来检查为此发布创建的标签。

Subversion allows the tag to be included in the connection URL. Neither Git nor Mercurial allow this, so the <tag>element is used instead.

Subversion 允许将标记包含在连接 URL 中。Git 和 Mercurial 都不允许这样做,因此使用该<tag>元素代替。