私はMaven3を使用して、サーバー、ejb、UIの3つの層を持つJavaアプリケーションを構築しています。EJBプロジェクトはサーバープロジェクトに依存しており、UIプロジェクトはEJBのみに依存しており、サーバーの推移的な依存関係を除外します。
UIプロジェクトが戦争として構築されている場合、dependency:treeコマンドに表示されないにもかかわらず、サーバーの依存関係が含まれています。
これが実行の関連する出力です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
そして、これが実行時の出力依存関係ツリーです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
サーバーへの依存は、2つのツリーの唯一の違いです。これらの2つの出力は常に同じであるべきではありませんか?何が原因で、dependency:treeに表示されないライブラリが含まれる可能性がありますか?
親POMは、モジュールを次のように定義します。
<modules>
<module>Server</module>
<module>EJB</module>
<module>UI</module>
</modules>
EJBPOMにリストされている依存関係は次のとおりです。
<dependencies>
<dependency>
<groupId>project.name</groupId>
<artifactId>Server</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
UIの依存関係は次のとおりです。
<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>
サーバーjarをWARに含めることから明示的に除外できることは承知していますが、実際の問題を修正したいと思います。