由于项目名称被附加到FETCH URL,因此Teamcity准备发布失败 [英] Teamcity prepare release failed due to project name got appended to FETCH URL
问题描述
我正在通过Temcity使用release-plugin
来准备发布。我得到的错误
[10:46 :19] [步骤2/3] [INFO]正在执行:/ bin / sh -c cd
/ home / tcagent / buildAgent / work / 860f91e0ad4abff2&& git push
https://用户名:****@testurl.com:8081 / scm / myrepo / my-project-name.git / ** buildConfName **
refs / heads / release /发布名称:refs / heads / release / release-name
[10:46:19] [步骤2/3] [INFO]工作目录:
/ home / tcagent / buildAgent / work / 860f91e0ad4abff2
[步骤2/3]无法执行目标
org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare
default-cli)项目** my-project-name **:无法提交文件
提供程序消息:git-push命令失败。命令输出:致命:
远程错误:找不到存储库请求的存储库不存在
,或者您没有权限访问它。
我的家长pom的SCM细节以下
< SCM>
< connection> scm:git:https://testurl.com:8081 / scm / myrepo / $ {env.TEAMCITY_BUILDCONF_NAME} .git< / connection>
< developerConnection> scm:git:https://testurl.com:8081 / scm / myrepo / $ {env.TEAMCITY_BUILDCONF_NAME} .git< / developerConnection>
< tag> 1.0.0< / tag>
< / scm>
我保持我的存储桶名称,buildConfName和工件id相同。当我构建父项目时,它运行成功,但是当我运行时试图构建Child模块时,我看到buildConfName被自动附加到在Parent POM中配置的SCM url。
Can任何人都请说出为什么额外的项目名称被添加
谢谢
经过一整天的努力,我发现下面发现
-
我在所有其他项目中使用父pom,只是将公共属性,常用构建步骤,通用依赖版本和由于所有项目都具有虚线依赖关系,并且实际上并不是maven模块化项目。所以在pom maven中,在scm连接url中添加了artifact id,这对于模块化项目来说是正确的行为。
-
鉴于在git中,我的项目为每个模块分别存储库,而不是父项目的子目录。这会导致构建失败,因为没有找到由于URL形成错误而导致存储库不存在的问题。
因此,我使用环境驱动的属性配置为定义scm连接URL,如下所示。 I am using parent pom in all my other project to just put common properties , common build steps , common dependency version and SCM details as all the project have dotted dependencies and which is not actually maven Modular project. So in child pom maven was appending the artifact id in the scm connection url which is correct behaviour in terms of modular project.
Whereas in git My project is having separate repository for each module and not the subdirectories to parent projects. this results in build failure as repository not found due to wrong url formation.
父pom.xml中的变化如下
<简档>
<个人资料>
< id>父母< / id>
<激活>
<属性>
< name> scmModule< / name>
<值>父< /值>
< / property>
< / activation>
<属性>
< scmConnection> scm:git:https://testurl.com:8081 / scm / ** myrepo / my-parent.git **< / scmConnection>
< scmDeveloperConnection> scm:git:https://testurl.com:8081 / scm / myrepo ** / my-parent.git **< / scmDeveloperConnection>
< / properties>
< / profile>
<个人资料>
< id>子< / id>
<激活>
<属性>
< name> scmModule< / name>
<值>子< /值>
< / property>
< / activation>
<属性>
< scmConnection> scm:git:https://testurl.com:8081 / scm / ** myrepo / **< / scmConnection>
< scmDeveloperConnection> scm:git:https://testurl.com:8081 / scm / ** myrepo / **< / scmDeveloperConnection>
< / properties>
< / profile>
< / profiles>
< scm>
< connection> $ {scmConnection}< / connection>
< developerConnection> $ {scmDeveloperConnection}< / developerConnection>
< tag> 1.0.0< / tag>
< / scm>
运行构建时,我使用下面的命令
用于构建父项目
mvn发行版:prepare -DscmModule =父
用于构建子项目/ Module
mvn发布:prepare -DscmModule = child
这解决了我的问题,因为maven开始附加artifact id并形成正确的url
I am doing prepare release through Temcity using release-plugin I got below error
[10:46:19][Step 2/3] [INFO] Executing: /bin/sh -c cd
/home/tcagent/buildAgent/work/860f91e0ad4abff2 && git push
https://username:****@testurl.com:8081/scm/myrepo/my-project-name.git/**buildConfName**
refs/heads/release/release-name:refs/heads/release/release-name
[10:46:19][Step 2/3] [INFO] Working directory:
/home/tcagent/buildAgent/work/860f91e0ad4abff2
[Step 2/3] Failed to execute goal
org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare
(default-cli) on project **my-project-name**: Unable to commit files
Provider message: The git-push command failed. Command output: fatal:
remote error: Repository not found The requested repository does not
exist, or you do not have permission to access it.
my parent pom have below SCM details
<scm>
<connection>scm:git:https://testurl.com:8081/scm/myrepo/${env.TEAMCITY_BUILDCONF_NAME}.git</connection>
<developerConnection>scm:git:https://testurl.com:8081/scm/myrepo/${env.TEAMCITY_BUILDCONF_NAME}.git</developerConnection>
<tag>1.0.0</tag>
</scm>
I kept my bit-bucket repository name , buildConfName and artifact id same. When i build the parent project it ran successfully , but when I ran tried to build the Child module I see buildConfName got appended automatically to the SCM url configured in Parent POM
Can anyone please tell why extra project name is added?
Thanks
After doing a whole day efforts I found below findings
So I use environment driven properties to be configured for defining the scm connection URL as given below.
changes in the parent pom.xml as below
<profiles>
<profile>
<id>parent</id>
<activation>
<property>
<name>scmModule</name>
<value>parent</value>
</property>
</activation>
<properties>
<scmConnection>scm:git:https://testurl.com:8081/scm/**myrepo/my-parent.git**</scmConnection>
<scmDeveloperConnection>scm:git:https://testurl.com:8081/scm/myrepo**/my-parent.git**</scmDeveloperConnection>
</properties>
</profile>
<profile>
<id>child</id>
<activation>
<property>
<name>scmModule</name>
<value>child</value>
</property>
</activation>
<properties>
<scmConnection>scm:git:https://testurl.com:8081/scm/**myrepo/**</scmConnection>
<scmDeveloperConnection>scm:git:https://testurl.com:8081/scm/**myrepo/**</scmDeveloperConnection>
</properties>
</profile>
</profiles>
<scm>
<connection>${scmConnection}</connection>
<developerConnection>${scmDeveloperConnection}</developerConnection>
<tag>1.0.0</tag>
</scm>
While running the build I am using below commands
for building the parent project
mvn release:prepare -DscmModule=parent
for building the child project/Module
mvn release:prepare -DscmModule=child
This resolves my issue as for child module as maven started appending artifact id and formed the correct url
这篇关于由于项目名称被附加到FETCH URL,因此Teamcity准备发布失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!