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

前端 未结 1 1991
無奈伤痛
無奈伤痛 2020-12-22 07:44

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/buildAg         


        
相关标签:
1条回答
  • 2020-12-22 08:44

    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

    0 讨论(0)
提交回复
热议问题