【问题标题】:Is it possible to use the Maven POM file for the configuration of GIT Tag for the maven release plugin?是否可以使用 Maven POM 文件为 Maven 发布插件配置 GIT Tag?
【发布时间】:2020-06-23 21:12:58
【问题描述】:

我想使用 Maven 发布插件来准备发布,方法是在提交中添加一个 GIT 标记,仅包含版本号,例如 1.0.0 。我希望能够为提交消息设置前缀。 现在默认标签是这样的:project-name-1.0.0。 提交消息也是由 maven Release 插件在准备阶段添加的,它的前缀是:[maven-release-plugin]

这些默认值在 release:prepare 阶段生成,并放在 release.properties 文件中。

我想在 maven POM 文件中的某处设置变量默认值,以便每个版本都具有相同的 GIT 标记默认参数和提交消息的前缀。

有人知道怎么做吗?

这是我的 POM 文件的一部分,maven-release 目前没有其他参数。

<scm>
        <connection>scm:git:https://example@example/mq-copy.git</connection>
        <url>https://example@example/mq-copy.git</url>
        <developerConnection>scm:git:https://example@example/mq-copy.git</developerConnection>
        <tag>HEAD</tag>
  </scm>

这是生成的 release.properties 文件:

#release configuration
#Tue Jun 23 22:30:00 CEST 2020
scm.tagNameFormat=@{project.artifactId}-@{project.version}
scm.tag=mq-copy-2.0.4
pushChanges=true
scm.url=scm\:git\:https\://example@example/mq-copy.git
preparationGoals=clean verify
project.dev.nl.bpittens.mq\:mq-copy=2.0.5-SNAPSHOT
remoteTagging=true
projectVersionPolicyId=default
scm.commentPrefix=[maven-release-plugin] 
project.scm.nl.bpittens.mq\:mq-copy.connection=scm\:git\:https\://example@example/mq-copy.git
project.scm.nl.bpittens.mq\:mq-copy.developerConnection=scm\:git\:https\://example@example/mq-copy.git
project.rel.nl.bpittens.mq\:mq-copy=2.0.4
project.scm.nl.bpittens.mq\:mq-copy.tag=HEAD
exec.snapshotReleasePluginAllowed=false
exec.additionalArguments=-P sagro
completedPhase=end-release
project.scm.nl.bpittens.mq\:mq-copy.url=https\://example@example/mq-copy.git

【问题讨论】:

    标签: maven maven-release-plugin


    【解决方案1】:

    我找到了部分问题的答案。但它回答了这个特定的问题。我只需在插件部分的 pom.xml 文件中添加带有类似配置参数的插件:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>2.5.3</version>
        <configuration>
             <tag>${project.version}</tag>
        </configuration>
    </plugin>
    

    【讨论】:

      猜你喜欢
      • 2014-07-22
      • 1970-01-01
      • 1970-01-01
      • 2012-10-14
      • 2017-01-27
      • 2019-06-07
      • 1970-01-01
      • 1970-01-01
      • 2016-06-27
      相关资源
      最近更新 更多