[ 
http://jira.codehaus.org/browse/MNG-5057?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Benjamin Bentmann closed MNG-5057.
----------------------------------

    Resolution: Not A Bug

bq. Please note that the hibernate-entitymanager is scoped test, [...] 
Therefore none of its transitive dependencies should affect a conflict 
resolution when building the WAR
Well, this is a misunderstanding. Dependency resolution is independent of the 
process consuming dependencies, i.e. it doesn't matter whether you package a 
WAR or run a unit test, the set of artifacts is calculated once and each 
artifact has exactly one scope. This ensures that the same dependency is used 
during compilation, packaging and testing of the project. As such it doesn't 
matter whether {{hibernate-entitymanager}} is scoped test, its transitive 
dependencies have a conflict with other dependencies of the project and this 
conflict needs to be solved. And as said, this conflict exists even when the 
WAR is packaged which will not contain {{hibernate-entitymanager}} but can well 
contain some of its transitive dependencies in case of conflicts with other 
dependencies. Slightly modified example:
{noformat}
project
   org.hibernate:hibernate-entitymanager:jar:3.4.0.GA:test
      dom4j:dom4j:jar:1.6.1:compile
         foo:bar:1:compile
   org.axonframework:axon-core:jar:0.7.1:compile
      dom4j:dom4j:jar:1.1:compile
{noformat}
Same conflict around {{dom4j}}. Following nearest-wins conflict resolution, 
{{dom4j:1.6.1}} gets picked and the system has no solid foundation to argue 
that it can safely drop {{foo:bar:1}} as a compile dependency without breaking 
{{dom4j:1.6.1}}.

> The order in which you declare dependencies in pom.xml affect resulting WAR 
> file
> --------------------------------------------------------------------------------
>
>                 Key: MNG-5057
>                 URL: http://jira.codehaus.org/browse/MNG-5057
>             Project: Maven 2 & 3
>          Issue Type: Bug
>          Components: Dependencies
>    Affects Versions: 3.0.3
>         Environment: Apache Maven 3.0.3 (r1075438; 2011-02-28 18:31:09+0100)
> Maven home: /Users/lars/tools/apache-maven-3.0.3
> Java version: 1.6.0_24, vendor: Apple Inc.
> Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
> Default locale: en_US, platform encoding: MacRoman
> OS name: "mac os x", version: "10.6.6", arch: "x86_64", family: "mac"
>            Reporter: Lars Vonk
>            Assignee: Benjamin Bentmann
>            Priority: Critical
>         Attachments: web-with-xml-apis.zip, web-without-xml-apis.zip
>
>
> When I declare my pom as follows (see attached war-with-xml-apis.zip) then 
> the jar file xml-apis-1.0.b2 is in my WAR file:
> {code:xml}
> <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/maven-v4_0_0.xsd";>
>     <modelVersion>4.0.0</modelVersion>
>     <groupId>ripe</groupId>
>     <artifactId>web</artifactId>
>     <packaging>war</packaging>
>     <version>0.0.1-SNAPSHOT</version>
>     <name>web Maven Webapp</name>
>     <url>http://maven.apache.org</url>
>     <dependencies>
>         <dependency>
>             <groupId>com.atomikos</groupId>
>             <artifactId>transactions-jta</artifactId>
>             <version>3.6.4</version>
>             <scope>test</scope>
>         </dependency>
>         <dependency>
>             <groupId>org.hibernate</groupId>
>             <artifactId>hibernate-entitymanager</artifactId>
>             <version>3.4.0.GA</version>
>             <scope>test</scope>
>         </dependency>
>         <dependency>
>             <groupId>org.axonframework</groupId>
>             <artifactId>axon-core</artifactId>
>             <version>0.7.1</version>
>             <exclusions>
>                 <exclusion>
>                     <groupId>xml-apis</groupId>
>                     <artifactId>xml-apis</artifactId>
>                 </exclusion>
>             </exclusions>
>         </dependency>
>     </dependencies>
>     <build>
>         <finalName>web</finalName>
>     </build>
> </project>
> {code}
> However, when I declare my pom as follows (axon-core is moved one up) then 
> the xml-apis.jar is no longer in my WAR.
> {code:xml}
> <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/maven-v4_0_0.xsd";>
>     <modelVersion>4.0.0</modelVersion>
>     <groupId>ripe</groupId>
>     <artifactId>web</artifactId>
>     <packaging>war</packaging>
>     <version>0.0.1-SNAPSHOT</version>
>     <name>web Maven Webapp</name>
>     <url>http://maven.apache.org</url>
>     <dependencies>
>         <dependency>
>             <groupId>com.atomikos</groupId>
>             <artifactId>transactions-jta</artifactId>
>             <version>3.6.4</version>
>             <scope>test</scope>
>         </dependency>
>         <dependency>
>             <groupId>org.axonframework</groupId>
>             <artifactId>axon-core</artifactId>
>             <version>0.7.1</version>
>             <exclusions>
>                 <exclusion>
>                     <groupId>xml-apis</groupId>
>                     <artifactId>xml-apis</artifactId>
>                 </exclusion>
>             </exclusions>
>         </dependency>
>         <dependency>
>             <groupId>org.hibernate</groupId>
>             <artifactId>hibernate-entitymanager</artifactId>
>             <version>3.4.0.GA</version>
>             <scope>test</scope>
>         </dependency>
>     </dependencies>
>     <build>
>         <finalName>web</finalName>
>     </build>
> </project>
> {code}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to