我正在使用 Maven 3.9 和 Java Spring Boot 3.1.1 应用程序以及 Bitbucket 和 Git。
我正在尝试处理发布版本控制。
pom.xml
<scm>
<connection>scm:git:git://[email protected]/travellinckcorpdevelopers/notification-service.git</connection>
<developerConnection>scm:git:ssh://[email protected]/travellinckcorpdevelopers/notification-service.git</developerConnection>
<url>https://bitbucket.org/travellinckcorpdevelopers/notification-service</url>
</scm>
以下命令按预期工作,它增加了 pom.xml 文件中的
project.version
:
mvn -B release:prepare
接下来,当我运行此命令以将更新的 pom 提交到 git 时:
mvn -B release:perform
它返回以下错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:3.1.1:perform (default-cli) on project notification-service: Unable to checkout from SCM
[ERROR] Provider message:
[ERROR] The git-clone command failed.
[ERROR] Command output:
[ERROR] Cloning into 'checkout'...
[ERROR] ssh: Could not resolve hostname bitbucket.org:travellinckcorpdevelopers: Name or service not known
[ERROR] fatal: Could not read from remote repository.
[ERROR]
[ERROR] Please make sure you have the correct access rights
[ERROR] and the repository exists.
更多信息
为了测试我是否有权访问存储库,我运行:
ssh -T [email protected]
返回:
authenticated via ssh key.
问题
我的连接定义不正确吗?我的用户(公钥)是否缺少访问权限?你知道我该如何解决这个问题吗?
以下内容为我解决了:
<scm>
<connection>scm:git:ssh://[email protected]/travellinckcorpdevelopers/notification-service.git</connection>
<developerConnection>scm:git:ssh://[email protected]/travellinckcorpdevelopers/notification-service.git</developerConnection>
<url>ssh://[email protected]/travellinckcorpdevelopers/notification-service</url>
<tag>notification-service-0.0.1</tag>
</scm>
所以它使用的是 ssh 而不是 https
我还必须删除chached的release.properties才能获取新的url