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

Christian Schulte commented on MNG-5971:
----------------------------------------

@[~snicoll]: The way the override logic got implemented isn't incorrect. What 
is incorrect is that there is no way to override things in child projects. See 
the updated description of this issue. That's fixed now. Just execute {{mvn 
validate}} with a recent 3.4.0-SNAPSHOT on the following pom. You need to put 
the conflicting dependencies coming from multiple imports into the pom (nearer) 
to resolve the conflicts. Maven did not warn about this and silently dropped 
conflicting dependencies. It shouldn't have done that.

{code}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0";
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
  <modelVersion>4.0.0</modelVersion>
  <groupId>localhost</groupId>
  <artifactId>MNG-5971</artifactId>
  <version>1-SNAPSHOT</version>
  <packaging>pom</packaging>
  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.3.2.RELEASE</version>
  </parent>
  <dependencyManagement>
    <dependencies>
      <!--
      Consider the following dependency declarations as being logically 
equivalent
      to a parent declaration. This pom is the child, the imports are the 
parent.
      So everything in this child needs to override what is imported from the 
parent.
      -->
      <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-framework-bom</artifactId>
        <version>4.2.4.RELEASE</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-config</artifactId>
        <version>1.0.3.RELEASE</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
</project>
{code}


> Imported dependencies should be available to inheritance processing
> -------------------------------------------------------------------
>
>                 Key: MNG-5971
>                 URL: https://issues.apache.org/jira/browse/MNG-5971
>             Project: Maven
>          Issue Type: Wish
>          Components: Dependencies
>    Affects Versions: 3.3.3
>            Reporter: Stephane Nicoll
>            Assignee: Christian Schulte
>            Priority: Trivial
>
> When a project extends from a parent with a {{dependencyManagement}} section, 
> it is not always possible to properly override (and align) the version to use 
> for a group of dependencies.
> We typically use Bill Of Materials to gather a group of modules and make sure 
> their versions are consistent. 
> The following project demonstrates the issue: 
> https://github.com/snicoll-scratches/maven-dependency-management
> The first commit is a working use case where the parent uses a bom with 
> version A and we use the same bom with version B in the child. Version B is 
> used as expected.
> The second commit demonstrates the faulty scenario. Rather than using a bom 
> in the parent, we use a direct dependency (provided by that bom). We still 
> use the bom with a different version. In that case all the dependencies but 
> the one provided by the parent are overridden (leading to mixed versions for 
> the dependencies provided by the BOM).
> It looks like the distance is still used to compute the version while the 
> graph of dependencies should be flatten at each step for a proper override. 
> Thoughts? Thanks!



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to