2013-01-15 20 views
2

任何人都可以解释为什么我会得到不同的排序树和Maven依赖插件上的构建类路径之间的输出?Maven依赖插件在构建类路径和树之间的排序差异

我跑

mvn -pl releases org.apache.maven.plugins:maven-dependency-plugin:2.6:tree -Dtokens=whitespace -outputFile=tree.txt -DexcludeTransitive=true

在命令行来生成输出。树的输出反映了在pom文件中定义的顺序,而来自build-classpath的输出却没有。从树http://pastebin.com/J2Q6iTK6

从集结类路径http://pastebin.com/k2SdrHP7

任何了解输出

输出将不胜感激。

Maven的配置

 <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-dependency-plugin</artifactId> 
      <version>2.6</version> 
      <executions> 
       <execution> 
        <id>generate-classpath-windows</id> 
        <phase>generate-resources</phase> 
        <goals> 
         <goal>build-classpath</goal> 
        </goals> 
        <configuration> 
         <pathSeparator>,</pathSeparator> 
         <prefix>..\jars</prefix> 
         <fileSeparator>\</fileSeparator> 
         <outputFile>${project.build.directory}/deployment/bin/classpath.windows</outputFile> 
        </configuration> 
       </execution> 
       <execution> 
        <id>generate-classpath-unix</id> 
        <phase>generate-sources</phase> 
        <goals> 
         <goal>build-classpath</goal> 
        </goals> 
        <configuration> 
         <pathSeparator>:</pathSeparator> 
         <prefix>../jars</prefix> 
         <fileSeparator>/</fileSeparator> 
         <outputFile>${project.build.directory}/deployment/bin/classpath.unix</outputFile> 
        </configuration> 
       </execution> 
       <execution> 
        <id>copy-dependencies</id> 
        <phase>package</phase> 
        <goals> 
         <goal>copy-dependencies</goal> 
        </goals> 
        <configuration> 
         <outputDirectory>${project.build.directory}/deployment/jars</outputDirectory> 
        </configuration> 
       </execution> 
      </executions> 
      <configuration> 
       <overWriteReleases>false</overWriteReleases> 
       <overWriteSnapshots>true</overWriteSnapshots> 
       <overWriteIfNewer>true</overWriteIfNewer> 
       <excludeTransitive>true</excludeTransitive> 
       <includeScope>runtime</includeScope> 
       <regenerateFile>true</regenerateFile> 
      </configuration> 
     </plugin> 

信息

Apache Maven 3.0.4 (r1232337; 2012-01-17 08:44:56+0000) 
Maven home: C:\apps\apache-maven-3.0.4 
Java version: 1.6.0_37, vendor: Sun Microsystems Inc. 
Java home: C:\Program Files\Java\jdk1.6.0_37\jre 
Default locale: en_GB, platform encoding: Cp1252 
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows" 

回答

1

类路径是线性表示,树木是嵌套的。 Maven应该首先在类路径中保留根级别依赖关系,因为它们最接近,所以应该首先解决。

从你的输出看,虽然这看起来很奇怪,但我没有看到我期望的正常逻辑重新构建类路径。

另外,直到2.6版本的依赖插件,在Maven 3.x上,dependency:tree输出是不正确的。我想知道是否有一个来自同一根本原因的build-classpath中的错误。我会ping这个问题到[email protected]看是否有人(Hervé谁修复dependency:tree)知道答案...