Note that there are some explanatory texts on larger screens.

plurals
  1. POMaven Build different to Dependency Tree
    text
    copied!<p>I am using Maven 3 to build a java application with 3 tiers - server, ejb and ui. The EJB project is dependent on the Server project, and the UI project is only dependent on EJB, and provides an exclusion for the Server transitive dependency.</p> <p>When the UI project is built as a war, the Server dependency is being included despite it not showing up on dependency:tree command.</p> <p>Here is the relevant output of running <code>mvn dependency:tree</code></p> <pre><code>**project.name:UI:war:1.0 SNAPSHOT** +- project.name:Common:jar:1.0 SNAPSHOT:compile | + org_common:_lib:jar:16.0.006:compile | | +- log4j:log4j:jar:1.2.16:compile | | \- commons configuration:commons configuration:jar:1.6:compile | | +- commons lang:commons lang:jar:2.4:compile | | +- commons digester:commons digester:jar:1.8:compile | | \- commons beanutils:commons beanutils core:jar:1.8.0:compile | +- org_common:_security_lib:jar:16.0.006:compile | \- org.springframework:spring:jar:2.0:compile +- **project.name:EJB:ejb client:client:1.0 SNAPSHOT:compile** | \- com.ibm.websphere.appserver:j2ee:jar:7.0.0.9:compile +- org_common:_uicomponent:jar:16.0.006:compile </code></pre> <p>And here is the output dependency tree from when running <code>mvn clean install -X</code></p> <pre><code>**project.name:UI:war:1.0 SNAPSHOT** +- project.name:Common:jar:1.0 SNAPSHOT:compile | + org_common:_lib:jar:16.0.006:compile | | +- log4j:log4j:jar:1.2.16:compile | | \- commons configuration:commons configuration:jar:1.6:compile | | +- commons lang:commons lang:jar:2.4:compile | | +- commons digester:commons digester:jar:1.8:compile | | \- commons beanutils:commons beanutils core:jar:1.8.0:compile | +- org_common:_security_lib:jar:16.0.006:compile | \- org.springframework:spring:jar:2.0:compile +- **project.name:EJB:ejb client:client:1.0 SNAPSHOT:compile** | +- **project.name:Server:jar:1.0 SNAPSHOT:compile** | | +- javassist:javassist:jar:3.4.GA:compile | | +- project.filestore:filestore_client:jar:7.0.003:compile | | +- com.ibm.db2:db2jcc:jar:9.7.fp1.aix64.s091114:compile | | +- com.ibm.db2:db2java:jar:9.7.fp1.aix64.s091114:compile | | +- com.ibm.db2:db2jcc_license_cu:jar:9.7.fp1.aix64.s091114:compile | \- com.ibm.websphere.appserver:j2ee:jar:7.0.0.9:compile +- org_common:_uicomponent:jar:16.0.006:compile </code></pre> <p>The dependency on Server is the only difference between the two trees. Shouldn't these two outputs always be the same? What could cause a library to be included that does not show up in dependency:tree?</p> <p>The parent POM defines the modules as:</p> <pre><code>&lt;modules&gt; &lt;module&gt;Server&lt;/module&gt; &lt;module&gt;EJB&lt;/module&gt; &lt;module&gt;UI&lt;/module&gt; &lt;/modules&gt; </code></pre> <p>The dependency listed in the EJB POM is:</p> <pre><code>&lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;project.name&lt;/groupId&gt; &lt;artifactId&gt;Server&lt;/artifactId&gt; &lt;version&gt;${project.version}&lt;/version&gt; &lt;/dependency&gt; &lt;/dependencies&gt; </code></pre> <p>The dependency in the UI is:</p> <pre><code>&lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;project.name&lt;/groupId&gt; &lt;artifactId&gt;EJB&lt;/artifactId&gt; &lt;version&gt;${project.version}&lt;/version&gt; &lt;type&gt;ejb-client&lt;/type&gt; &lt;exclusions&gt; &lt;exclusion&gt; &lt;groupId&gt;project.name&lt;/groupId&gt; &lt;artifactId&gt;Server&lt;/artifactId&gt; &lt;/exclusion&gt; &lt;/exclusions&gt; &lt;/dependency&gt; &lt;/dependencies&gt; </code></pre> <p>I am aware that I can explicitly exclude the Server jar from being included in the WAR, but I would prefer to fix the actual issue.</p>
 

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