Teamcity prepare release failed due to project name got appended to FETCH URL

萝らか妹 提交于 2019-11-29 18:07:06

After doing a whole day efforts I found below findings

  1. 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.

  2. 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.

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!