【发布时间】:2011-05-05 04:26:54
【问题描述】:
我有一个由几个 jar 模块和一个 war 模块组成的多模块项目。当我执行 mvn 包时,会创建战争,但战争的 lib 文件夹中不包含一个依赖项(javax.mail)。 依赖项设置为编译是主pom。战争不依赖于 mail.jar,但 module.jar 是。 当我做 mvn dependency:tree 时,这三个对我来说看起来不错。在调试中运行也不会显示任何错误。
有人有想法吗?
BB 彼得
编辑:在我的主 POM 中
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.1</version>
<scope>compile</scope>
</dependency>
作为托管依赖项。模块jar依赖如下:
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</dependency>
war 模块不依赖于 javax.mail。
编辑2:
我确实像这样覆盖主 pom 中的战争插件:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1</version>
<configuration>
<warName>${war.name}</warName>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<manifestEntries>
<Implementation-Build>${buildNumber}</Implementation-Build>
</manifestEntries>
</archive>
</configuration>
</plugin>
【问题讨论】:
-
战争是否依赖于依赖mail.jar的模块??
-
作为测试,我在war pom中添加了对javax.mail的依赖,然后mail.jar被添加到war中...必须调查:-)
标签: maven-2 dependencies war