Maven版本插件无法将标签推送到准备目标中

使用Bitbucket 6.0.1,Maven 3.6.2,发行插件2.5.3,git 2.13.2
Jenkins执行了创建发行版的工作,在执行结帐操作时,我可以看到git repo的正确URL。

2019-Nov-13_1810 Building remotely on Slave09 in workspace C:/workspace/Tashtit-Spring-Dev-Build
2019-Nov-13_1810  > git.exe rev-parse --is-inside-work-tree # timeout=10
2019-Nov-13_1810 Fetching changes from the remote Git repository
2019-Nov-13_1810  > git.exe config remote.origin.url ssh://git@pa2vmp56.blmain.prod:7999/tas/tashtit.git # timeout=10
2019-Nov-13_1810 Fetching upstream changes from ssh://git@pa2vmp56.blmain.prod:7999/tas/tashtit.git
2019-Nov-13_1810  > git.exe --version # timeout=10
2019-Nov-13_1810  > git.exe fetch --tags --progress ssh://git@pa2vmp56.blmain.prod:7999/tas/tashtit.git +refs/heads/*:refs/remotes/origin/*
2019-Nov-13_1811  > git.exe rev-parse "refs/remotes/origin/develop^{commit}" # timeout=10
2019-Nov-13_1811  > git.exe rev-parse "refs/remotes/origin/origin/develop^{commit}" # timeout=10
2019-Nov-13_1811 Checking out Revision 98c3ca202fc6f8388600858d7b9c43ef960962e4 (refs/remotes/origin/develop)
2019-Nov-13_1811  > git.exe config core.sparsecheckout # timeout=10
2019-Nov-13_1811  > git.exe checkout -f 98c3ca202fc6f8388600858d7b9c43ef960962e4
2019-Nov-13_1811  > git.exe branch -a -v --no-abbrev # timeout=10
2019-Nov-13_1811  > git.exe branch -D develop # timeout=10
2019-Nov-13_1811  > git.exe checkout -b develop 98c3ca202fc6f8388600858d7b9c43ef960962e4
2019-Nov-13_1811 Commit message: "pom.xml edited online with Bitbucket"
2019-Nov-13_1811  > git.exe rev-list --no-walk 98c3ca202fc6f8388600858d7b9c43ef960962e4 # timeout=10  

正确的网址是:

ssh://git@pa2vmp56.blmain.prod:7999/tas/tashtit.git

但是在标记阶段运行时,URL有点混乱:

2019-Nov-13_1855 [INFO] Executing: cmd.exe /X /C "git symbolic-ref HEAD"

2019-Nov-13_1855 [INFO] Working directory: C:\workspace\Tashtit-Spring-Dev-Build\tashtit.parent

2019-Nov-13_1855 [INFO] Executing: cmd.exe /X /C "git push ssh:********@pa2vmp56.blmain.prod:7999/tas/tashtit.git refs/heads/develop:refs/heads/develop"

2019-Nov-13_1855 [INFO] Working directory: C:\workspace\Tashtit-Spring-Dev-Build\tashtit.parent

2019-Nov-13_1855 [INFO] Tagging release with the label tashtit.spring_build_1902.01.1911131852...

2019-Nov-13_1855 [INFO] Executing: cmd.exe /X /C "git tag -F C:\Users\TVLRTC~1\AppData\Local\Temp\maven-scm-1423733870.commit tashtit.spring_build_1902.01.1911131852"

2019-Nov-13_1855 [INFO] Working directory: C:\workspace\Tashtit-Spring-Dev-Build

2019-Nov-13_1855 [INFO] Executing: cmd.exe /X /C "git push ssh:********@pa2vmp56.blmain.prod:7999/tas refs/tags/tashtit.spring_build_1902.01.1911131852"

2019-Nov-13_1855 [INFO] Working directory: C:\workspace\Tashtit-Spring-Dev-Build

如您所见,URL已损坏:

git push ssh:********@pa2vmp56.blmain.prod:7999/tas

它应该显示上面的网址
Jenkins作业从脚本运行以下命令:

mvn org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare -Dtag=${teamName}_build_$releaseVersion -DautoVersionSubmodules=true -DreleaseVersion=$releaseVersion -DdevelopmentVersion=0.1-snAPSHOT

这是错误:

2019-Nov-13_1855 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare (default-cli) on project tashtit.parent: Unable to tag SCM

2019-Nov-13_1855 [ERROR] Provider message:

2019-Nov-13_1855 [ERROR] The git-push command failed.

2019-Nov-13_1855 [ERROR] Command output:

2019-Nov-13_1855 [ERROR] Repository not found

2019-Nov-13_1855 [ERROR] The requested repository does not exist,or you do not have permission to access it.

2019-Nov-13_1855 [ERROR] fatal: Could not read from remote repository.

2019-Nov-13_1855 [ERROR] 

2019-Nov-13_1855 [ERROR] Please make sure you have the correct access rights

2019-Nov-13_1855 [ERROR] and the repository exists.

2019-Nov-13_1855 [ERROR] 

这是pom中的SCM部分:

<scm>
        <url>http://pa2vmp56.blmain.prod:7990/scm/tas/tashtit.git</url>
        <connection>scm:git:ssh://git@pa2vmp56.blmain.prod:7999/tas/tashtit.git</connection>
        <developerConnection>scm:git:ssh://git@pa2vmp56.blmain.prod:7999/tas/tashtit.git</developerConnection>
        <tag>HEAD</tag>
    </scm>

只有这个仓库有麻烦,在其他运行良好的项目下,我们还有更多的git仓库。
有什么想法吗?

fengws_sd 回答:Maven版本插件无法将标签推送到准备目标中

我不知道为什么会这样,我认为这与git repo的扁平结构有关。
在Jenkins Job中,我发送了两个参数(适合于先前的结构):

parent.folder=tashtit.parent
ear.folder=../tashtit.spring.junits/target

在更改了结构以将父pom作为平面文件而不是包含在其自己的maven项目中之后,我更改了如下参数:

parent.folder=.
ear.folder=tashtit.spring.junits/target

从那时起,一切都会按预期开始。

本文链接:https://www.f2er.com/3108303.html

大家都在问