Note that there are some explanatory texts on larger screens.

plurals
  1. POmaven 3 dependency plugin - inconsistent result
    primarykey
    data
    text
    <p>I am migrating my project from maven 2 (2.2.1) to maven 3 (3.1.0) and I am having some issues with jar versions. When I tried to track down the problem, I experienced some inconsistent results from <em>dependency plugin</em> which confused me.</p> <p>When I tried the following commands in <strong>maven 3</strong>:</p> <pre><code>mvn dependency:tree -Dincludes=commons-codec </code></pre> <p>the results was:</p> <pre><code>[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ xxx --- [INFO] com.xxx.yyy:zzz:war:2.6-SNAPSHOT [INFO] \- net.sourceforge.jwebunit:jwebunit-htmlunit-plugin:jar:2.2:test [INFO] \- net.sourceforge.htmlunit:htmlunit:jar:2.5:test [INFO] \- commons-codec:commons-codec:jar:1.3:compile [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS </code></pre> <p>so the result suggest <strong>commons-codec-1.3.jar</strong> will be used. (maven 3 does include commons-codec-1.3.jar when packing).</p> <p>However, if I add the option (-Dverbose) to the command </p> <pre><code>mvn dependency:tree -Dincludes=commons-codec -Dverbose </code></pre> <p>the result will be </p> <pre><code>[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ xxx --- [INFO] com.xxx.yyy:zzz:war:2.6-SNAPSHOT [INFO] +- net.sourceforge.jwebunit:jwebunit-htmlunit-plugin:jar:2.2:test [INFO] | \- net.sourceforge.htmlunit:htmlunit:jar:2.5:test [INFO] | +- commons-httpclient:commons-httpclient:jar:3.1:test [INFO] | | \- (commons-codec:commons-codec:jar:1.2:test - omitted for conflict with 1.3) [INFO] | \- (commons-codec:commons-codec:jar:1.3:compile - scope updated from test; omitted for duplicate) [INFO] \- xxx.yyy.zzz.core:www-core:jar:2.6-SNAPSHOT:compile [INFO] +- org.apache.httpcomponents:httpclient:jar:4.2.2:compile [INFO] | \- commons-codec:commons-codec:jar:1.6:compile [INFO] \- xxx.yyy.zzz.security:datasecurity:jar:2.0:compile [INFO] \- (commons-codec:commons-codec:jar:1.3:compile - omitted for conflict with 1.6) [INFO] ------------------------------------------------------------------------ </code></pre> <p>The second result suggests that the version <strong>1.2</strong> and <strong>1.3</strong> will be omitted due to conflict, and maven will use <strong>1.6</strong>. Apparently it was not the case since <strong>maven 3</strong> packaged <strong>commons-codec-1.3.jar</strong> in the war file. </p> <p>Why did the plugin in maven 3 suggest different dependencies in two cases (It should not as -Dverbose should only show which dependencies omitted and why)? Is it a bug or am I missing something?</p> <p>It is worth to note that <strong>maven 2</strong> will package with <strong>commons-codec-1.6.jar</strong>.</p> <p>P/s:</p> <ul> <li>Since version 2.5 of the Maven Dependency Plugin, dependency:tree works with Maven 3 - <a href="https://stackoverflow.com/questions/7425910/maven3-how-do-i-found-dependency-resolution-mvn-depedencytree-does-not-wor">Maven3 - How do I found dependency resolution? ( mvn depedency:tree does not work for mvn3 )</a></li> <li>verbose: Whether to include omitted nodes in the serialized dependency tree. - <a href="http://maven.apache.org/plugins/maven-dependency-plugin/tree-mojo.html" rel="nofollow noreferrer">http://maven.apache.org/plugins/maven-dependency-plugin/tree-mojo.html</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload