Craig Otis
Craig Otis

Reputation: 32054

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. I'm using m2e for dependency management. My project, in the Project Facets tab, has the Dynamic Web Module enabled, along with Java. In addition, under my Deployment Assembly I have the Maven dependencies listed, but no inclusion/exclusion options:

enter image description here

My WAR builds fine, and runs fine in 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:

enter image description here

I was able to remove tomcat-catalina-7.0.30.jar (not pictured) by including in my POM.xml:

    <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. I don't want to add ~20 provided entries to remove the rest of them.

Upvotes: 1

Views: 1579

Answers (1)

Aaron Digulla
Aaron Digulla

Reputation: 328556

Look at the POMs of your project. Somewhere, someone added them without the proper scope.

In Eclipse, you can use the POM editor. 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.

Upvotes: 2

Related Questions