title: How to prevent duplicate servlet jar using eclipse+m2eclipse
body: <p>I'm using Eclipse + Maven + m2eclipse to build and test a web application in Apache Tomcat.</p>
  
  <p>I've configured a Tomcat server inside Eclipse, and configured the deployment assembly for my web app, including "Maven Dependencies" (specialization of Java Build Path Entries).</p>
  
  <p>When I deploy and start the server, Tomcat/Catalina always warns me:</p>
  
  <blockquote>
    <p>INFO: validateJarFile(/projects/src/main/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/webapp/WEB-INF/lib/servlet-api-2.5.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class</p>
  </blockquote>
  
  <p>This is because m2eclipse sees servlet-api-2.5 as a dependency of my project, and considers it as part of "Maven Dependencies", and copies it as part of the deployment assembly, but the Tomcat servlet container has its own copy of this and doesn't like seeing 2 copies on the class path.</p>
  
  <p>I've marked the dependency from my project to servlet-api-2.5 in my pom.xml with</p>
  
  <pre><code>&lt;scope&gt;
  provided
  &lt;/scope&gt;
  </code></pre>
  
  <p>which does prevent standalone Maven from packaging servlet-api-2.5 into my builds, but m2eclipse doesn't see it that way.</p>
  
  <p>(This isn't a huge deal because the warning is harmless, I only see it during testing inside the IDE, and real customers won't see it, but I'd still like to know how to fix it because I like cleanliness and I like knowing how things work.)</p>
  
  <p>Is there a correct way to tell m2eclipse not to deploy this file, or to tell Eclipse not to let m2eclipse have the final say on which dependencies are runtime dependencies?</p>
  
  <p>I did find <a href="https://issues.sonatype.org/browse/MNGECLIPSE-1193" rel="noreferrer">https://issues.sonatype.org/browse/MNGECLIPSE-1193</a> which mentions</p>
  
  <blockquote>
    <p>the "Maven Dependencies" container reflects test compile time scope, so it is supposed to have dependencies with scope "provided"</p>
  </blockquote>