简体   繁体   中英

Where do I configure jarsToSkip option when using tomcat7-maven-plugin

Im using maven with tomcat7-maven plugin and its working quite well. Recently I noticed a message saying

At least one JAR was scanned for TLDs yet contained no TLDs. 
Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them.

So I did some reasearch and realised I need to set the jarsToSkip property for the jars that dont contain TLDs. I have been looking into how to find which jars it is that is causing the problem but with little luck it seams tomcat7-maven-plugin is nott passing my loggersettings that are required for output of names of the jars.

Also I do not know where I set the jarsToSkip property when I have found the jars.

Any help would be appreciated.

Believe the property jarsToSkip is a "catalina.properties" entry. Where ever your Tomcat conf folder is look at file "catalina.properties" and you should see a property like this around line 90 or so:

tomcat.util.scan.DefaultJarScanner.jarsToSkip=\

You should be able to add jars to that list to prevent them from being scanned.

As far as finding which jars are causing the issues, that would be a little more difficult to determine. Probably some trial and error work to be done there.

When using the Tomcat 7 Maven Plugin, anything you would otherwise have put in catalina.properties can go in your plugin config. ie

<plugin>
  <groupId>org.apache.tomcat.maven</groupId>
  <artifactId>tomcat7-maven-plugin</artifactId>
  <version>2.0</version>
  <configuration>
    <useTestClasspath>true</useTestClasspath>
    <path>/</path>
    <systemProperties>
      <tomcat.util.scan.DefaultJarScanner.jarsToSkip>
        myjar.jar
      </tomcat.util.scan.DefaultJarScanner.jarsToSkip>
    </systemProperties>
  </configuration>
</plugin>

There seems to be a bug with the maven tomcat plugin prior to 2.2 (ie 2.0) where the <systemProperties> don't seem to be propagated. Also in 2.2 a config option called <jarScanAllDirectories> was added which seems to improve performance even more (I think it ignores WEB-INF/classes).

Ignoring port and path I found the following configuration to greatly improve Maven Tomcat performance.

        <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <port>9090</port>
                <path>/</path>
                <jarScanAllDirectories>false</jarScanAllDirectories>
                <systemProperties>
                    <org.apache.catalina.startup.ContextConfig.jarsToSkip>*.jar</org.apache.catalina.startup.ContextConfig.jarsToSkip>
                    <tomcat.util.scan.DefaultJarScanner.jarsToSkip>*.jar</tomcat.util.scan.DefaultJarScanner.jarsToSkip>
                </systemProperties>
            </configuration>
        </plugin>

There is this open bug @ https://github.com/psi-probe/psi-probe/issues/348

Just pointing out.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM