截断maven release tag push的SCM(git)URL

时间:2014-05-09 11:40:28

标签: git maven maven-release-plugin

出于某种原因,当运行maven版本时,它只是为推送的标记部分提供了一个无效的URL。对于pom.xml提交/推送,它工作正常并转到适当的URL。见下文:

[INFO] Working directory: /opt/jenkins-home/jobs/Section 4362/workspace/section4362-parent
[INFO] Executing: /bin/sh -c cd "/opt/jenkins-home/jobs/Section 4362/workspace/section4362-parent" && git commit --verbose -F /tmp/maven-scm-217365030.commit '/opt/jenkins-home/jobs/Section 4362/workspace/section4362-services/pom.xml' '/opt/jenkins-home/jobs/Section 4362/workspace/section4362-webapp/pom.xml' '/opt/jenkins-home/jobs/Section 4362/workspace/section4362-static/pom.xml' pom.xml
[INFO] Working directory: /opt/jenkins-home/jobs/Section 4362/workspace/section4362-parent
[INFO] Executing: /bin/sh -c cd "/opt/jenkins-home/jobs/Section 4362/workspace/section4362-parent" && git symbolic-ref HEAD
[INFO] Working directory: /opt/jenkins-home/jobs/Section 4362/workspace/section4362-parent
[INFO] Executing: /bin/sh -c cd "/opt/jenkins-home/jobs/Section 4362/workspace/section4362-parent" && git push ssh://git@github.com/{org}/Section4362.git maven-release-test:maven-release-test
[INFO] Working directory: /opt/jenkins-home/jobs/Section 4362/workspace/section4362-parent
[INFO] Tagging release with the label section4362-parent-0.3...
[INFO] Executing: /bin/sh -c cd "/opt/jenkins-home/jobs/Section 4362/workspace" && git tag -F /tmp/maven-scm-882610155.commit section4362-parent-0.3
[INFO] Working directory: /opt/jenkins-home/jobs/Section 4362/workspace
[INFO] Executing: /bin/sh -c cd "/opt/jenkins-home/jobs/Section 4362/workspace" && git push ssh://git@github.com/{org} section4362-parent-0.3
[INFO] Working directory: /opt/jenkins-home/jobs/Section 4362/workspace

你可以看到,对于提交后的推送,它会推送到ssh://git@github.com/{org}/Section4362.git({org}被我擦除),而对于标签之后的推送,它会转到ssh://git@github.com/{org} - URL应该最后包括/Section4362.git。我的所有pom文件都指定了正确的:scm:git:ssh://git@github.com/{org}/Section4362.git

如何更改标签推送的URL以及从哪里获取它?在那一步说,构建显然无法连接到repo。

2 个答案:

答案 0 :(得分:3)

maven-release-plugin中存在一个未解决的问题,必须修复才能让事情发生。有关详细信息,请参阅http://jira.codehaus.org/browse/MRELEASE-767。不幸的是,在解决git URL转换中的错误之前,除了不将更改推送到git之外,没有什么可做的。

答案 1 :(得分:3)

我有同样的问题。 我使用jdk 1.7,maven 3.3.9和maven-release plugin 2.5.3

我看了一下与这个问题相关的jira,我没有发现它是固定的:-(

https://issues.apache.org/jira/browse/MRELEASE-939

https://issues.apache.org/jira/browse/MRELEASE-927

我找到了一个技巧,以便maven不会使用用于推动标签的网址。

我使用相同的url精确地在pom.xml中推送和获取SCM url。首先定义push url然后获取而不是相反的重要。 这是一个例子。

<scm>
<connection>scm:git:https://gitlab.com/gitlab-org/java-project-template-single-scm.git</connection>
<developerConnection>scm:git:[push=]https://gitlab.com/gitlab-org/java-project-template-single-scm.git[fetch=]https://gitlab.com/gitlab-org/java-project-template-single-scm.git</developerConnection>
<url>https://gitlab.com/gitlab-org/java-project-template-single-scm.git</url>
<tag>HEAD</tag>
</scm>