Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何从jar中排除包(使用maven)_Java_Maven_Jar_Build_Geronimo - Fatal编程技术网

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,并将其排除在您的依赖项中。”对于您提供的所有依赖项,为我完成了这项工作。谢谢