[
https://jira.codehaus.org/browse/MNG-5690?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=352828#comment-352828
]
Tobias Oberlies commented on MNG-5690:
--------------------------------------
BTW, the m2eclipse "Dependency Hierarchy" view nicely shows what seems to go
wrong when the above project is resolved: For the second time, the
cxf-api:2.7.5 dependency is listed in the tree, m2e displays a node annotated
with "omitted for conflict with 2.7.5" and no children. If that second time is
the path via the compile dependency to cxf-rt-frontend-jaxrs, which has the
exclusion, it seems that there is no second resolution of the dependency and
hence the first resolution without exclusions (but test scope) wins.
> Test scope dependency adds compile dependency to library which was excluded
> on the compile dependency path
> ----------------------------------------------------------------------------------------------------------
>
> Key: MNG-5690
> URL: https://jira.codehaus.org/browse/MNG-5690
> Project: Maven
> Issue Type: Bug
> Reporter: Tobias Oberlies
>
> Consider two libraries with the following, simplified dependency graph:
> {noformat}
> +- org.apache.cxf:cxf-rt-transports-local:jar:2.7.5
> +- org.apache.cxf:cxf-api:jar:2.7.5:compile
> +-
> org.apache.geronimo.specs:geronimo-javamail_1.4_spec:jar:1.7.1:compile
> +- org.apache.cxf:cxf-rt-frontend-jaxrs:jar:2.7.5
> +- org.apache.cxf:cxf-api:jar:2.7.5:compile
> +-
> org.apache.geronimo.specs:geronimo-javamail_1.4_spec:jar:1.7.1:compile
> {noformat}
> The following situations work as expected:
> # When adding a test dependency to cxf-rt-transports-local in my war project,
> the geronimo-javamail library *is not* assembled into the war.
> # When adding a compile dependency to cxf-rt-frontend-jaxrs, the
> geronimo-javamail library *is* assembled into the war.
> # When adding a compile dependency to cxf-rt-frontend-jaxrs with an exclusion
> of the geronimo-javamail, the library *is not* assembled into the war.
> The unexpected behaviour occurs when combining the dependencies from point 1
> and 3 (with the test dependency being listed above the compile dependency).
> In this case, the geronimo-javamail libary *is* assembled into the war,
> although I only have a test scope dependency to it.
> The following pom.xml reproduces the problem:
> {noformat}
> <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>org.example</groupId>
> <artifactId>test-dep-overrides-productive-exclusion</artifactId>
> <version>0.0.1-SNAPSHOT</version>
> <packaging>war</packaging>
> <properties>
> <cxf.version>2.7.5</cxf.version>
> </properties>
> <dependencies>
> <dependency>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-rt-transports-local</artifactId>
> <version>${cxf.version}</version>
> <scope>test</scope>
> </dependency>
> <dependency>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-rt-frontend-jaxrs</artifactId>
> <version>${cxf.version}</version>
> <exclusions>
> <exclusion>
>
> <groupId>org.apache.geronimo.specs</groupId>
>
> <artifactId>geronimo-javamail_1.4_spec</artifactId>
> </exclusion>
> </exclusions>
> </dependency>
> </dependencies>
> </project>
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.1.6#6162)