title: how to disable tomcat manifest scanning with spring boot?
body: <p>We have a dependency (JAR) which does contain a manifest file refering to other JARs in it's <code>Class-Path</code> entry. These referenced other JARs are not required for the application and thus are not added as dependencies.</p>
  
  <p>When the app gets started, tomcat tries to resolve that class-path entry and you ends up with lots of errors in the log. Like:</p>
  
  <pre><code>The Class-Path manifest attribute in /Users/me/.m2/repository/org/bytedeco/javacpp-presets/openblas/0.3.3-1.4.3/openblas-0.3.3-1.4.3.jar referenced one or more files that do not exist: file:/Users/me/.m2/repository/org/bytedeco/javacpp-presets/openblas/0.3.3-1.4.3/javacpp.jar
  The Class-Path manifest attribute in /Users/me/.m2/repository/org/bytedeco/javacpp-presets/mkl-platform/2019.0-1.4.3/mkl-platform-2019.0-1.4.3.jar referenced one or more files that do not exist: file:/Users/me/.m2/repository/org/bytedeco/javacpp-presets/mkl-platform/2019.0-1.4.3/mkl.jar,file:/Users/me/.m2/repository/org/bytedeco/javacpp-presets/mkl-platform/2019.0-1.4.3/mkl-linux-x86.jar,file:/Users/me/.m2/repository/org/bytedeco/javacpp-presets/mkl-platform/2019.0-1.4.3/mkl-linux-x86_64.jar,file:/Users/me/.m2/repository/org/bytedeco/javacpp-presets/mkl-platform/2019.0-1.4.3/mkl-macosx-x86_64.jar,file:/Users/me/.m2/repository/org/bytedeco/javacpp-presets/mkl-platform/2019.0-1.4.3/mkl-windows-x86.jar,file:/Users/me/.m2/repository/org/bytedeco/javacpp-presets/mkl-platform/2019.0-1.4.3/mkl-windows-x86_64.jar
  The Class-Path manifest attribute in /Users/me/.m2/repository/org/bytedeco/javacpp-presets/mkl/2019.0-1.4.3/mkl-2019.0-1.4.3.jar referenced one or more files that do not exist: file:/Users/me/.m2/repository/org/bytedeco/javacpp-presets/mkl/2019.0-1.4.3/javacpp.jar
  The Class-Path manifest attribute in /Users/me/.m2/repository/org/bytedeco/javacpp-presets/mkl-dnn-platform/0.16-1.4.3/mkl-dnn-platform-0.16-1.4.3.jar referenced one or more files that do not exist: file:/Users/me/.m2/repository/org/bytedeco/javacpp-presets/mkl-dnn-platform/0.16-1.4.3/mkl-dnn.jar,file:/Users/me/.m2/repository/org/bytedeco/javacpp-presets/mkl-dnn-platform/0.16-1.4.3/mkl-dnn-linux-x86_64.jar,file:/Users/me/.m2/repository/org/bytedeco/javacpp-presets/mkl-dnn-platform/0.16-1.4.3/mkl-dnn-macosx-x86_64.jar,file:/Users/me/.m2/repository/org/bytedeco/javacpp-presets/mkl-dnn-platform/0.16-1.4.3/mkl-dnn-windows-x86_64.jar
  The Class-Path manifest attribute in /Users/me/.m2/repository/org/bytedeco/javacpp-presets/mkl-platform/2019.0-1.4.3/mkl-platform-2019.0-1.4.3.jar referenced one or more files that do not exist: file:/Users/me/.m2/repository/org/bytedeco/javacpp-presets/mkl-platform/2019.0-1.4.3/mkl.jar,file:/Users/me/.m2/repository/org/bytedeco/javacpp-presets/mkl-platform/2019.0-1.4.3/mkl-linux-x86.jar,file:/Users/me/.m2/repository/org/bytedeco/javacpp-presets/mkl-platform/2019.0-1.4.3/mkl-linux-x86_64.jar,file:/Users/me/.m2/repository/org/bytedeco/javacpp-presets/mkl-platform/2019.0-1.4.3/mkl-macosx-x86_64.jar,file:/Users/me/.m2/repository/org/bytedeco/javacpp-presets/mkl-platform/2019.0-1.4.3/mkl-windows-x86.jar,file:/Users/me/.m2/repository/org/bytedeco/javacpp-presets/mkl-platform/2019.0-1.4.3/mkl-windows-x86_64.jar
  ...
  WARNING: Failed to scan [file:/Users/domi/.m2/repository/org/bytedeco/javacpp-presets/hdf5-platform/1.10.3-1.4.3/hdf5.jar] from classloader hierarchy
  java.io.IOException: java.lang.reflect.InvocationTargetException
      at org.apache.tomcat.util.compat.Jre9Compat.jarFileNewInstance(Jre9Compat.java:212)
      at org.apache.tomcat.util.scan.JarFileUrlJar.&lt;init&gt;(JarFileUrlJar.java:65)
      at org.apache.tomcat.util.scan.JarFactory.newInstance(JarFactory.java:49)
      at org.apache.tomcat.util.scan.StandardJarScanner.process(StandardJarScanner.java:374)
      at org.apache.tomcat.util.scan.StandardJarScanner.processURLs(StandardJarScanner.java:309)
  ...
  Caused by: java.lang.reflect.InvocationTargetException
      at java.base/jdk.internal.reflect.GeneratedConstructorAccessor78.newInstance(Unknown Source)
      at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
      at org.apache.tomcat.util.compat.Jre9Compat.jarFileNewInstance(Jre9Compat.java:209)
      ... 49 more
  Caused by: java.nio.file.NoSuchFileException: /Users/domi/.m2/repository/org/bytedeco/javacpp-presets/hdf5-platform/1.10.3-1.4.3/hdf5.jar
      at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
      at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
      at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
      at java.base/sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
      at java.base/sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:145)
      at java.base/java.nio.file.Files.readAttributes(Files.java:1763)
      at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1222)
      at java.base/java.util.zip.ZipFile$CleanableResource.&lt;init&gt;(ZipFile.java:726)
  ...
  
  </code></pre>
  
  <p>As described here, Tomcat has implemented a switch to disable the scanning of the manifest to prevent this issues: <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=59961" rel="nofollow noreferrer">https://bz.apache.org/bugzilla/show_bug.cgi?id=59961</a></p>
  
  <p>In a normal tomcat installation we could just do this (<a href="https://tomcat.apache.org/tomcat-8.0-doc/config/jar-scanner.html" rel="nofollow noreferrer">https://tomcat.apache.org/tomcat-8.0-doc/config/jar-scanner.html</a>):</p>
  
  <pre><code>&lt;Context&gt;
    ...
    &lt;JarScanner scanManifest="false"/&gt;
  &lt;/Context&gt;
  </code></pre>
  
  <p>how to disable tomcat manifest scanning with spring boot?</p>