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

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

Those warnings would appear if declared directly. That's the point. I 
understand people rely on the override logic based on the order of elements. 
There has not been another way to do that. You could do it smarter starting 
with 3.4. I understand the former behaviour needs to be restored. I'll need to 
add integration tests for this. If so many people rely on that, this really 
should be captured in an IT.

{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>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aop</artifactId>
        <version>4.2.4.RELEASE</version>
      </dependency>
      <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aop</artifactId>
        <version>4.2.3.RELEASE</version>
      </dependency>
    </dependencies>
  </dependencyManagement>
</project>
{code}


{code}
Apache Maven 3.3.9 (8512d6f051da85fdd21c8c1f939f3aac2ae287c2; 
2015-11-19T00:20:09+01:00)
Maven home: /home/schulte/Applications/apache-maven-3.3.9
Java version: 1.8.0_45, vendor: Oracle Corporation
Java home: /usr/local/jdk-1.8.0/jre
Default locale: en_DE, platform encoding: UTF-8
OS name: "openbsd", version: "5.8", arch: "amd64", family: "unix"
{code}

{code}
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for 
localhost:MNG-5971:pom:1-SNAPSHOT
[WARNING] 
'dependencyManagement.dependencies.dependency.(groupId:artifactId:type:classifier)'
 must be unique: org.springframework:spring-aop:jar -> version 4.2.4.RELEASE vs 
4.2.3.RELEASE @ line 17, column 19
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten 
the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support 
building such malformed projects.
[WARNING] 
{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: Bug
>          Components: Dependencies
>    Affects Versions: 3.3.3
>            Reporter: Stephane Nicoll
>            Assignee: Christian Schulte
>            Priority: Trivial
>              Labels: close-pending
>             Fix For: 3.4.0
>
>         Attachments: bom-cloud.zip
>
>
> 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