title: Maven adding jars to war which are not present in dependency:tree
body: <p>I've recently prepared spring-boot configuration to work properly on a standalone jetty.</p>
  
  <p>I've encountered a strange behavior from maven. It adds jars to my .war archive which are not present in <code>mvn dependency:tree</code>. I've worked around the problem by adding this to my pom.xml:</p>
  
  <pre><code>&lt;plugin&gt;
      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
      &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
      &lt;configuration&gt;
          &lt;packagingExcludes&gt;WEB-INF/lib/tomcat-*.jar&lt;/packagingExcludes&gt;
      &lt;/configuration&gt;
  &lt;/plugin&gt;
  </code></pre>
  
  <p>But that's obviously an ugly solution.</p>
  
  <p>pom.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;com.pretius&lt;/groupId&gt;
      &lt;artifactId&gt;springBootJettyExample&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;name&gt;Spring-Boot jetty example app&lt;/name&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
      &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;1.3.0.BUILD-SNAPSHOT&lt;/version&gt;
      &lt;/parent&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
               &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                      &lt;artifactId&gt;spring-boot-starter-tomcat&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
           &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-jetty&lt;/artifactId&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-jdbc&lt;/artifactId&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
                      &lt;artifactId&gt;tomcat-jdbc&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-actuator&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hsqldb&lt;/groupId&gt;
              &lt;artifactId&gt;hsqldb&lt;/artifactId&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt; 
            &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
            &lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;finalName&gt;spbj-example&lt;/finalName&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;packagingExcludes&gt;WEB-INF/lib/tomcat-*.jar&lt;/packagingExcludes&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
      &lt;repositories&gt;
          &lt;repository&gt;
              &lt;id&gt;spring-snapshots&lt;/id&gt;
              &lt;url&gt;http://repo.spring.io/snapshot&lt;/url&gt;
              &lt;snapshots&gt;
                  &lt;enabled&gt;true&lt;/enabled&gt;
              &lt;/snapshots&gt;
          &lt;/repository&gt;
          &lt;repository&gt;
              &lt;id&gt;spring-milestones&lt;/id&gt;
              &lt;url&gt;http://repo.spring.io/milestone&lt;/url&gt;
          &lt;/repository&gt;
      &lt;/repositories&gt;
      &lt;pluginRepositories&gt;
          &lt;pluginRepository&gt;
              &lt;id&gt;spring-snapshots&lt;/id&gt;
              &lt;url&gt;http://repo.spring.io/snapshot&lt;/url&gt;
          &lt;/pluginRepository&gt;
          &lt;pluginRepository&gt;
              &lt;id&gt;spring-milestones&lt;/id&gt;
              &lt;url&gt;http://repo.spring.io/milestone&lt;/url&gt;
          &lt;/pluginRepository&gt;
      &lt;/pluginRepositories&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>mvn dependency:tree:</p>
  
  <pre><code>[INFO] Scanning for projects...
  [INFO]                                                                         
  [INFO] ------------------------------------------------------------------------
  [INFO] Building Spring-Boot jetty example app 0.0.1-SNAPSHOT
  [INFO] ------------------------------------------------------------------------
  [INFO] 
  [INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ springBootJettyExample ---
  [INFO] com.pretius:springBootJettyExample:war:0.0.1-SNAPSHOT
  [INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.3.0.BUILD-SNAPSHOT:compile
  [INFO] |  +- org.springframework.boot:spring-boot-starter:jar:1.3.0.BUILD-SNAPSHOT:compile
  [INFO] |  |  +- org.springframework.boot:spring-boot:jar:1.3.0.BUILD-SNAPSHOT:compile
  [INFO] |  |  +- org.springframework.boot:spring-boot-autoconfigure:jar:1.3.0.BUILD-SNAPSHOT:compile
  [INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:1.3.0.BUILD-SNAPSHOT:compile
  [INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.1.3:compile
  [INFO] |  |  |  |  \- ch.qos.logback:logback-core:jar:1.1.3:compile
  [INFO] |  |  |  +- org.slf4j:jul-to-slf4j:jar:1.7.12:compile
  [INFO] |  |  |  \- org.slf4j:log4j-over-slf4j:jar:1.7.12:compile
  [INFO] |  |  +- org.springframework:spring-core:jar:4.2.2.BUILD-SNAPSHOT:compile
  [INFO] |  |  \- org.yaml:snakeyaml:jar:1.16:runtime
  [INFO] |  +- org.springframework.boot:spring-boot-starter-validation:jar:1.3.0.BUILD-SNAPSHOT:compile
  [INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.0.26:compile
  [INFO] |  |  \- org.hibernate:hibernate-validator:jar:5.2.1.Final:compile
  [INFO] |  |     +- javax.validation:validation-api:jar:1.1.0.Final:compile
  [INFO] |  |     \- com.fasterxml:classmate:jar:1.1.0:compile
  [INFO] |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.6.1:compile
  [INFO] |  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.6.1:compile
  [INFO] |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.6.1:compile
  [INFO] |  +- org.springframework:spring-web:jar:4.2.2.BUILD-SNAPSHOT:compile
  [INFO] |  |  +- org.springframework:spring-aop:jar:4.2.2.BUILD-SNAPSHOT:compile
  [INFO] |  |  |  \- aopalliance:aopalliance:jar:1.0:compile
  [INFO] |  |  +- org.springframework:spring-beans:jar:4.2.2.BUILD-SNAPSHOT:compile
  [INFO] |  |  \- org.springframework:spring-context:jar:4.2.2.BUILD-SNAPSHOT:compile
  [INFO] |  \- org.springframework:spring-webmvc:jar:4.2.2.BUILD-SNAPSHOT:compile
  [INFO] |     \- org.springframework:spring-expression:jar:4.2.2.BUILD-SNAPSHOT:compile
  [INFO] +- org.springframework.boot:spring-boot-starter-jetty:jar:1.3.0.BUILD-SNAPSHOT:provided
  [INFO] |  +- org.eclipse.jetty:jetty-servlets:jar:9.2.13.v20150730:provided
  [INFO] |  |  +- org.eclipse.jetty:jetty-continuation:jar:9.2.13.v20150730:provided
  [INFO] |  |  +- org.eclipse.jetty:jetty-http:jar:9.2.13.v20150730:provided
  [INFO] |  |  +- org.eclipse.jetty:jetty-util:jar:9.2.13.v20150730:provided
  [INFO] |  |  \- org.eclipse.jetty:jetty-io:jar:9.2.13.v20150730:provided
  [INFO] |  +- org.eclipse.jetty:jetty-webapp:jar:9.2.13.v20150730:provided
  [INFO] |  |  +- org.eclipse.jetty:jetty-xml:jar:9.2.13.v20150730:provided
  [INFO] |  |  \- org.eclipse.jetty:jetty-servlet:jar:9.2.13.v20150730:provided
  [INFO] |  |     \- org.eclipse.jetty:jetty-security:jar:9.2.13.v20150730:provided
  [INFO] |  |        \- org.eclipse.jetty:jetty-server:jar:9.2.13.v20150730:provided
  [INFO] |  +- org.eclipse.jetty.websocket:websocket-server:jar:9.2.13.v20150730:provided
  [INFO] |  |  +- org.eclipse.jetty.websocket:websocket-common:jar:9.2.13.v20150730:provided
  [INFO] |  |  |  \- org.eclipse.jetty.websocket:websocket-api:jar:9.2.13.v20150730:provided
  [INFO] |  |  +- org.eclipse.jetty.websocket:websocket-client:jar:9.2.13.v20150730:provided
  [INFO] |  |  \- org.eclipse.jetty.websocket:websocket-servlet:jar:9.2.13.v20150730:provided
  [INFO] |  |     \- javax.servlet:javax.servlet-api:jar:3.1.0:provided
  [INFO] |  \- org.eclipse.jetty.websocket:javax-websocket-server-impl:jar:9.2.13.v20150730:provided
  [INFO] |     +- org.eclipse.jetty:jetty-annotations:jar:9.2.13.v20150730:provided
  [INFO] |     |  +- org.eclipse.jetty:jetty-plus:jar:9.2.13.v20150730:provided
  [INFO] |     |  |  \- org.eclipse.jetty:jetty-jndi:jar:9.2.13.v20150730:provided
  [INFO] |     |  +- javax.annotation:javax.annotation-api:jar:1.2:provided
  [INFO] |     |  +- org.ow2.asm:asm:jar:5.0.1:provided
  [INFO] |     |  \- org.ow2.asm:asm-commons:jar:5.0.1:provided
  [INFO] |     |     \- org.ow2.asm:asm-tree:jar:5.0.1:provided
  [INFO] |     +- org.eclipse.jetty.websocket:javax-websocket-client-impl:jar:9.2.13.v20150730:provided
  [INFO] |     \- javax.websocket:javax.websocket-api:jar:1.0:provided
  [INFO] +- org.springframework.boot:spring-boot-starter-jdbc:jar:1.3.0.BUILD-SNAPSHOT:compile
  [INFO] |  \- org.springframework:spring-jdbc:jar:4.2.2.BUILD-SNAPSHOT:compile
  [INFO] |     \- org.springframework:spring-tx:jar:4.2.2.BUILD-SNAPSHOT:compile
  [INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:1.3.0.BUILD-SNAPSHOT:compile
  [INFO] |  +- org.springframework.boot:spring-boot-starter-aop:jar:1.3.0.BUILD-SNAPSHOT:compile
  [INFO] |  |  +- org.aspectj:aspectjrt:jar:1.8.6:compile
  [INFO] |  |  \- org.aspectj:aspectjweaver:jar:1.8.6:compile
  [INFO] |  +- org.hibernate:hibernate-entitymanager:jar:4.3.11.Final:compile
  [INFO] |  |  +- org.jboss.logging:jboss-logging:jar:3.1.3.GA:compile
  [INFO] |  |  +- org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:compile
  [INFO] |  |  +- org.hibernate:hibernate-core:jar:4.3.11.Final:compile
  [INFO] |  |  |  +- antlr:antlr:jar:2.7.7:compile
  [INFO] |  |  |  \- org.jboss:jandex:jar:1.1.0.Final:compile
  [INFO] |  |  +- dom4j:dom4j:jar:1.6.1:compile
  [INFO] |  |  |  \- xml-apis:xml-apis:jar:1.0.b2:compile
  [INFO] |  |  +- org.hibernate.common:hibernate-commons-annotations:jar:4.0.5.Final:compile
  [INFO] |  |  +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
  [INFO] |  |  \- org.javassist:javassist:jar:3.18.1-GA:compile
  [INFO] |  +- javax.transaction:javax.transaction-api:jar:1.2:compile
  [INFO] |  +- org.springframework.data:spring-data-jpa:jar:1.9.0.RELEASE:compile
  [INFO] |  |  +- org.springframework.data:spring-data-commons:jar:1.11.0.RELEASE:compile
  [INFO] |  |  +- org.springframework:spring-orm:jar:4.2.2.BUILD-SNAPSHOT:compile
  [INFO] |  |  \- org.slf4j:jcl-over-slf4j:jar:1.7.12:compile
  [INFO] |  \- org.springframework:spring-aspects:jar:4.2.2.BUILD-SNAPSHOT:compile
  [INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:1.3.0.BUILD-SNAPSHOT:compile
  [INFO] |  \- org.springframework.boot:spring-boot-actuator:jar:1.3.0.BUILD-SNAPSHOT:compile
  [INFO] +- org.hsqldb:hsqldb:jar:2.3.3:runtime
  [INFO] \- org.slf4j:slf4j-log4j12:jar:1.7.12:compile
  [INFO]    +- org.slf4j:slf4j-api:jar:1.7.12:compile
  [INFO]    \- log4j:log4j:jar:1.2.17:compile
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD SUCCESS
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 2.746 s
  [INFO] Finished at: 2015-10-05T09:36:47+02:00
  [INFO] Final Memory: 21M/309M
  [INFO] ------------------------------------------------------------------------
  </code></pre>
  
  <p>(Yes, there is <em>one</em> tomcat lib in the tree, but there are several added to .war)</p>
  
  <p>Unwanted jars:</p>
  
  <pre><code>tomcat-embed-core-8.0.26.jar
  tomcat-embed-logging-juli-8.0.26.jar
  tomcat-embed-websocket-8.0.26.jar
  tomcat-jdbc-8.0.26.jar
  tomcat-juli-8.0.26.jar
  </code></pre>
  
  <p><a href="http://pretius.com/wp-content/uploads/2015/09/springBootJettyExample.zip" rel="nofollow">Here's a link to the sample application.</a></p>
  
  <p>What is adding the <code>tomcat*</code> jars to my .war? How can I stop it doing so?</p>