[ 
https://issues.apache.org/jira/browse/MNG-6507?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16694475#comment-16694475
 ] 

Karl Heinz Marbaise commented on MNG-6507:
------------------------------------------

For the version in the dependency please use ${project.version} instead...

> CI-friendly versioning doesn't work when included as dependency
> ---------------------------------------------------------------
>
>                 Key: MNG-6507
>                 URL: https://issues.apache.org/jira/browse/MNG-6507
>             Project: Maven
>          Issue Type: Bug
>          Components: Dependencies
>    Affects Versions: 3.6.0
>            Reporter: mike duigou
>            Priority: Major
>
> I saw in the 3.6.0 release notes that several issues for CI friendly versions 
> had been fixed so decided to try the feature.
> One of our reactor projects is (simplified):
> Reactor pom.xml:
> {{<project>}}
>  {{    <modelVersion>4.0.0</modelVersion>}}
>  {{    <parent>}}
>  {{        <groupId>com.example.app</groupId>}}
>  {{        <artifactId>Infrastructure</artifactId>}}
>  {{        <version>7</version>}}
>  {{    </parent>}}
>  {{    <groupId>com.example.app</groupId>}}
>  {{    <artifactId>Reactor</artifactId>}}
>  {{    <name>App Reactor</name>}}
>  {{    <description>App Reactor Project</description>}}
>  {{    <version>${revision}${changelist}</version>}}
>  {{    <packaging>pom</packaging>    <properties>}}
>  {{        <revision>3.2.0</revision>}}
>  {{        <changelist>-SNAPSHOT</changelist>}}
>  {{        <version.app>${revision}${changelist}</version.app>}}
>  {{    </properties>}}
>  {{    <modules>}}
>  {{        <module>core</module>}}
>  {{        <module>configuration</module>}}
>  {{    </modules>}}{{  }}
>  {{  ....}}{{  }}
>  \{{ </project>}}
> The configuration project pom.xml uses CI-friendly versioning:
> {{<project>}}
>  {{    <modelVersion>4.0.0</modelVersion>}}
>  {{    <parent>}}
>  {{        <groupId>com.example.app</groupId>}}
>  {{        <artifactId>Reactor</artifactId>}}
>  {{        <version>${revision}${changelist}</version>}}
>  {{    </parent>}}
>  {{    <groupId>com.example.app</groupId>}}
>  {{    <artifactId>Configuration</artifactId>}}
>  {{    <name>App Configuration</name>}}
>  {{    <packaging>jar</packaging>}}
>  {{     .....}}{{ }}
>  {{  </project>}}
> The core project pom.xml uses CI-friendly versioning:
> {{<project>}}
>  {{    <modelVersion>4.0.0</modelVersion>}}
>  {{    <parent>}}
>  {{        <groupId>com.example.app</groupId>}}
>  {{        <artifactId>Reactor</artifactId>}}
>  {{        <version>${revision}${changelist}</version>}}
>  {{    </parent>}}
>  {{    <groupId>com.example.app</groupId>}}
>  {{    <artifactId>Core</artifactId>}}
>  {{    <name>App Core</name>}}
>  {{    <packaging>jar</packaging>}}
>  {{    <dependencies>}}
>  {{        <dependency>}}
>  {{            <!-- Include App Configuration in classpath for tests -->}}
>  {{            <groupId>com.example.app</groupId>}}
>  {{            <artifactId>Configuration</artifactId>}}
>  {{            <version>${revision}${changelist}</version>}}
>  {{            <scope>test</scope>}}
>  {{        </dependency>}}
>  {{         .....}}
>  {{      </dependencies>}}
>  {{       .....}}
>  {{     </project>}}
>  
> When building the reactor everything works as expected but building the core 
> project independently results in maven attempting to resolve a version 
> ${revision}${changelist} from the repos:
> {{[ERROR] Failed to execute goal on project Core: Could not resolve 
> dependencies for project com.example:Core:jar:3.6.0-SNAPSHOT: Failed to 
> collect dependencies at com.example.app:Configuration:jar:3.6.0-SNAPSHOT: 
> Failed to read artifact descriptor for 
> com.example.app:Configuration:jar:3.6.0-SNAPSHOT: Failure to find 
> com.example.app:Reactor:pom:${revision}${changelist} in 
> [http://artifactory.example.com:8081/artifactory/libs-release] was cached in 
> the local repository, resolution will not be reattempted until the update 
> interval of central has elapsed or updates are forced -> [Help 1]}}
>  {{org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute 
> goal on project Core: Could not resolve dependencies for project 
> com.example:Core:jar:3.6.0-SNAPSHOT: Failed to collect dependencies at 
> com.example.app:Configuration:jar:3.6.0-SNAPSHOT}}
>  {{... stack omitted ...}}
>  {{Caused by: org.apache.maven.project.DependencyResolutionException: Could 
> not resolve dependencies for project com.example:Core:jar:3.6.0-SNAPSHOT: 
> Failed to collect dependencies at 
> com.example.app:Configuration:jar:3.6.0-SNAPSHOT}}
>  {{... stack omitted ...}}
>  {{Caused by: org.eclipse.aether.collection.DependencyCollectionException: 
> Failed to collect dependencies at 
> com.example.app:Configuration:jar:3.6.0-SNAPSHOT}}
>  {{... stack omitted ...}}{{ }}
>  {{Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: 
> Failed to read artifact descriptor for 
> com.example.app:Configuration:jar:3.6.0-SNAPSHOT}}
>  {{... stack omitted ...}}{{ }}
>  {{Caused by: org.apache.maven.model.resolution.UnresolvableModelException: 
> Failure to find com.example.app:Reactor:pom:${revision}${changelist} in 
> [http://artifactory.example.com:8081/artifactory/libs-release] was cached in 
> the local repository, resolution will not be reattempted until the update 
> interval of central has elapsed or updates are forced}}
>  {{... stack omitted ...}}{{ }}
>  {{Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: 
> Failure to find com.example.app:Reactor:pom:${revision}${changelist} in 
> [http://artifactory.example.com:8081/artifactory/libs-release] was cached in 
> the local repository, resolution will not be reattempted until the update 
> interval of central has elapsed or updates are forced}}
>  {{... stack omitted ...}}
>  {{Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Failure 
> to find com.example.app:Reactor:pom:${revision}${changelist} in 
> [http://artifactory.example.com:8081/artifactory/libs-release] was cached in 
> the local repository, resolution will not be reattempted until the update 
> interval of central has elapsed or updates are forced}}
>  {{... stack omitted ...}}
>  
> It appears there are some places that should be doing the property 
> substitution that are not, specifically in this case when including a pom as 
> a dependency.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to