Maven Building is Different from a Dependency Tree

I use Maven 3 to create a Java application with 3 levels - server, ejb and ui. The EJB project depends on the server design, and the user interface project depends only on the EJB and provides an exception for the transitive dependency of the server.

When a user interface project is created as a war, Server dependency is enabled, even though it is not displayed in the dependency command: tree.

Here is the relevant conclusion of the work mvn dependency:tree

**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

And here is the output dependency tree at startup mvn clean install -X

**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

Server dependency is the only difference between the two trees. Shouldn't these two outputs be the same? What could lead to the inclusion of a library that does not appear in the dependency: tree?

Parent POM defines modules as:

<modules>
    <module>Server</module>
    <module>EJB</module>
    <module>UI</module>
</modules>

, POM EJB:

<dependencies>
        <dependency>
            <groupId>project.name</groupId>
            <artifactId>Server</artifactId>
            <version>${project.version}</version>
        </dependency>
    </dependencies>

:

<dependencies>
        <dependency>
            <groupId>project.name</groupId>
            <artifactId>EJB</artifactId>
            <version>${project.version}</version>
            <type>ejb-client</type>
            <exclusions>
                <exclusion>
                    <groupId>project.name</groupId>
                    <artifactId>Server</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
</dependencies>

, Server WAR, .

+5
2

, Maven 3.0.3. 3.0.4 .

:

Maven ? 3.0.4, , . , Maven 3, 3.0.2.

+1

, . Maven 3 , : , . . .

https://cwiki.apache.org/MAVEN/maven-3x-compatibility-notes.html#Maven3.xCompatibilityNotes-DependencyResolution

mvn clean install -X .

Edit

2.5 Maven, dependency:tree Aether (. , )

+2

All Articles