Truncating SCM (git) URL for maven release tag push

…衆ロ難τιáo~ 提交于 2019-12-13 07:04:25

问题


For some reason, when running maven release, it is giving me an invalid URL just for the tagging part of the push. For the pom.xml commit/push, it works fine and goes to appropriate URL. See below:

[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

You can see that for the push after the commit, it pushes to ssh://git@github.com/{org}/Section4362.git ({org} scrubbed by me), whereas for the push after the tag, it goes to ssh://git@github.com/{org} – URL should include /Section4362.git at the end. All my pom files specify the correct: scm:git:ssh://git@github.com/{org}/Section4362.git

How would URL be changing for tag push and where would it get it from? Build is obviously failing at that step saying unable to connect to repo.


回答1:


There is an open issue in maven-release-plugin which has to be fixed in order to get things working. See http://jira.codehaus.org/browse/MRELEASE-767 for more details. Unfortunately, until the bug in git URL translation is resolved, not much can be done besides not pushing the changes to git.




回答2:


I had the same issue. I use jdk 1.7, maven 3.3.9 and maven-release plugin 2.5.3

I took a look at the jira releated to this issue and I do not found that is was fixed :-(

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

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

I found a trick so that maven do not troncate the url used for pushing the tag.

I precise both push and fetch SCM url in the pom.xml, using the same url. It is important to first define push url then fetch and not the opposite. Here is an exemple.

<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>


来源:https://stackoverflow.com/questions/42863170/maven-release-plugin-incompatible-with-gitlab-groups

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!