我正在尝试使用Maven发布插件进行发布,但出现错误
[ERROR] Command output:
[ERROR] GitLab: The project you were looking for could not be found.
[ERROR] fatal: The remote end hung up unexpectedly
在我的pom.xml中,这样的设置:
<scm>
<developerConnection>scm:git:ssh://git@git.domain.ua/myproject/mylib.git</developerConnection>
<url>https://git.domain.ua/myproject/mylib</url>
<tag>HEAD</tag>
</scm>
我的詹金斯工作设置:
存储库URL:ssh://git@git.domain.ua/myproject/mylib.git
凭据:我的ssh密钥也作为部署密钥导入了Git存储库
分支说明符(“ any”为空白):* / development
Maven发行版目标和选项:-Dresume = false发行版:分支javadoc:javadoc
DryRun目标和选项:-Dresume = false -DdryRun = true版本:准备
从日志中可以看到,Git插件成功克隆了一个分支,但是由于某些原因,Maven无法进行提交:
Cloning the remote Git repository
Cloning repository ssh://git@git.domain.ua/myproject/mylib.git
> git init /opt/jenkins/workspace/MYJOB # timeout=10
Fetching upstream changes from ssh://git@git.domain.ua/myproject/mylib.git
> git --version # timeout=10
using GIT_SSH to set credentials JENKINS(jenkins user with jenkins@USER)
git checkout development
Switched to a new branch 'development'
Branch development set up to track remote branch development from origin.
Parsing POMs
Established TCP socket on 44626
[INFO] Executing: /bin/sh -c cd /opt/jenkins/workspace/MYJOB && git push ssh://git@git.domain.ua/myproject/mylib.git refs/heads/development:refs/heads/development
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.1:branch (default-cli) on project MYPROJECT: Unable to commit files
[ERROR] Provider message:
[ERROR] The git-push command failed.
[JENKINS] Archiving /opt/jenkins/workspace/MYPROJECT/pom.xml to *****-SNAPSHOT.pom
[ERROR] Command output:
[ERROR] GitLab: The project you were looking for could not be found.
[ERROR] fatal: The remote end hung up unexpectedly
我猜Maven对使用Git插件的密钥一无所知,但是我不知道如何配置Maven Release Plugin使用相同的密钥?
答案 0 :(得分:0)
错误是通过 https 协议克隆的,而错误是通过 ssh 协议进行的。您必须定义用于传输的协议。为了进行比较,请使用命令git remote show origin
的结果,并在 pom.xml 文件中设置scm参数。
示例:
<scm>
<connection>scm:git:git@github.com:user/repo-name.git</connection>
<developerConnection>scm:git:git@github.com:user/repo-name.git</developerConnection>
<url>git@github.com:user/repo-name.git</url>
<tag>HEAD</tag>
</scm>
答案 1 :(得分:0)
尝试删除ssh://,然后仅使用:scm:git:git@git.domain.ua/myproject/mylib.git 将url标记替换为具有以下值的连接标记:scm:git:git@git.domain.ua/myproject/mylib.git
最后将是这样的:
scm:git:git@git.domain.ua/myproject/mylib.git
scm:git:git@git.domain.ua/myproject/mylib.git
插件也正在搜索大写的项目“ MYPROJECT”,或者我猜在gitlab中您拥有“ myproject”,您可以检查并将所有“ MYPROJECT”引用更改为“ myproject”,然后重试。
最诚挚的问候,
答案 2 :(得分:0)
尝试在Jenkins作业配置中执行此操作:
refs/heads/development
。