Maven 发布插件无法在准备目标中推送标签
Maven release plugin fail to push tags in the prepare goal
使用 Bitbucket 6.0.1,Maven 3.6.2,发布插件 2.5.3,git 2.13.2
Jenkins 执行创建发布的作业,在执行结帐操作时,我可以看到 git 存储库的正确 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
正确的 url 是:
ssh://git@pa2vmp56.blmain.prod:7999/tas/tashtit.git
但是当标记阶段 运行s 时,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
应该显示上面的内容url
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>
只有这个 repo 有问题,我们在其他项目下有更多 git repo 工作正常。
有什么想法吗?
我不知道为什么会这样,我认为这与 git 存储库的扁平结构有关。
在 Jenkins Job 中,我发送了两个参数(适合之前的结构):
parent.folder=tashtit.parent
ear.folder=../tashtit.spring.junits/target
在更改结构以将父 pom 作为平面文件而不是在它自己的 maven 项目中包含之后,我更改了如下参数:
parent.folder=.
ear.folder=tashtit.spring.junits/target
从那时起,一切都开始正常工作。
使用 Bitbucket 6.0.1,Maven 3.6.2,发布插件 2.5.3,git 2.13.2
Jenkins 执行创建发布的作业,在执行结帐操作时,我可以看到 git 存储库的正确 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
正确的 url 是:
ssh://git@pa2vmp56.blmain.prod:7999/tas/tashtit.git
但是当标记阶段 运行s 时,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
应该显示上面的内容url
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>
只有这个 repo 有问题,我们在其他项目下有更多 git repo 工作正常。
有什么想法吗?
我不知道为什么会这样,我认为这与 git 存储库的扁平结构有关。
在 Jenkins Job 中,我发送了两个参数(适合之前的结构):
parent.folder=tashtit.parent
ear.folder=../tashtit.spring.junits/target
在更改结构以将父 pom 作为平面文件而不是在它自己的 maven 项目中包含之后,我更改了如下参数:
parent.folder=.
ear.folder=tashtit.spring.junits/target
从那时起,一切都开始正常工作。