Java 如何从jar中排除包(使用maven)
我想从我的项目中排除Java 如何从jar中排除包(使用maven),java,maven,jar,build,geronimo,Java,Maven,Jar,Build,Geronimo,我想从我的项目中排除geronimo-javamail_1.4_specjar,我正在使用maven构建项目,我看到了这篇文章,并在我的pom.xml中添加了exclusion部分,但不知怎的,在我构建项目之后,我在war文件的WEB-INF\lib中看到了geronimo-javamail\u 1.4\u spec-1.7.1.jar 请告诉我如何将此jar从.war中排除。 <dependency> <groupId>org.apache.geronimo.s
geronimo-javamail_1.4_spec
jar,我正在使用maven构建项目,我看到了这篇文章,并在我的pom.xml
中添加了exclusion
部分,但不知怎的,在我构建项目之后,我在war文件的WEB-INF\lib
中看到了geronimo-javamail\u 1.4\u spec-1.7.1.jar
请告诉我如何将此jar从.war中排除。
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-javamail_1.4_spec</artifactId>
<version>1.4</version>
<scope>provided</scope>
</dependency>
This way the maven will add them to the compilation classpath, but will not package them
org.apache.geronimo.specs
geronimo-javamail_1.4_规范
1.4
假如
这样,maven会将它们添加到编译类路径中,但不会打包它们
如果声明为直接依赖项,则应使用提供的
。如果没有-那么你应该尝试mvn dependency:tree
,并找到添加它的所有位置。我使用mvn dependency:tree
找到了位置,我现在应该做什么?@Shahe“我现在应该做什么?”看起来像这样。“因此,您的解决方案将是显式地添加核心jar,并将其排除在您的依赖项中。”对于您提供的所有依赖项,为我完成了这项工作。谢谢