[英]Maven copying Tomcat JARs into webapp WEB-INF/lib directory
I have a very simple webapp published as a WAR file, being developed in Eclipse. 我有一个非常简单的Web应用程序,它发布为WAR文件,正在Eclipse中开发。 I'm using m2e for dependency management. 我正在使用m2e进行依赖性管理。 My project, in the Project Facets
tab, has the Dynamic Web Module
enabled, along with Java
. 我的项目在Project Facets
选项卡中,启用了Dynamic Web Module
以及Java
。 In addition, under my Deployment Assembly
I have the Maven dependencies listed, but no inclusion/exclusion options: 另外,在我的Deployment Assembly
下,我列出了Maven依赖项,但没有包含/排除选项:
My WAR builds fine, and runs fine in Eclipse. 我的WAR构建良好,并且在Eclipse中运行良好。 However , the Dynamic Web Module
seems to be resulting in my WAR file containing a number of Tomcat JARs, in addition to all my other dependencies: 但是 , Dynamic Web Module
似乎导致我的WAR文件除了所有其他依赖项之外还包含许多Tomcat JAR:
I was able to remove tomcat-catalina-7.0.30.jar
(not pictured) by including in my POM.xml: 通过包含在我的POM.xml中,我能够删除tomcat-catalina-7.0.30.jar
(未显示):
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-catalina</artifactId>
<version>7.0.30</version>
<scope>provided</scope>
</dependency>
But it seems there must be a way to tell Maven that the entire Tomcat container will be provided at runtime. 但是似乎必须有一种方法可以告诉Maven,将在运行时提供整个Tomcat 容器 。 I don't want to add ~20 provided
entries to remove the rest of them. 我不想添加〜20 provided
条目以删除其余的条目。
Look at the POMs of your project. 查看您的项目的POM。 Somewhere, someone added them without the proper scope
. 在某个地方,有人在没有适当scope
情况下添加了它们。
In Eclipse, you can use the POM editor. 在Eclipse中,可以使用POM编辑器。 There is a set of tabs at the bottom of the editor. 编辑器底部有一组选项卡。 One reads "Dependency Hierarchy". 有人读“依赖性层次结构”。 Here you can search for "tomcat" and m2e will tell you which POMs contain such a dependency. 在这里您可以搜索“ tomcat”,并且m2e会告诉您哪些POM包含此类依赖性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.