title: Embedded Tomcat with Servlet 3.0 - How to skip certain jars when scanning?
body: <p>Here is a simple method for an embedded Tomcat server that scans for Servlet 3.0 initializers:</p>
  
  <pre><code>public static void main(String[] args) throws ServletException, LifecycleException {
      Tomcat tomcat = new Tomcat();
      tomcat.setPort(8080);
  
      StandardContext ctx = (StandardContext) tomcat.addWebapp("/", new File("web").getAbsolutePath());
  
      //declare an alternate location for your "WEB-INF/classes" dir:     
      File additionWebInfClasses = new File("target/classes");
      VirtualDirContext resources = new VirtualDirContext();
      resources.setExtraResourcePaths("/WEB-INF/classes=" + additionWebInfClasses);
      ctx.setResources(resources);
  
      tomcat.start();
      System.out.println("Started");
      tomcat.getServer().await();
  }
  </code></pre>
  
  <p>I know that the property <code>tomcat.util.scan.DefaultJarScanner.jarsToSkip</code> in <code>catalina.properties</code> allows you to limit which jars are scanned to speed deployment time.  How would I incorporate this same idea into the embedded Tomcat code here?</p>
  
  <p>BONUS: Is there a way to specify which jars to <em>include</em> instead of which jars to <em>skip</em>?</p>