简体   繁体   English

使用tomcat7-maven-plugin时在哪里配置jarsToSkip选项

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

Im using maven with tomcat7-maven plugin and its working quite well. 我将tomcat7-maven插件与maven一起使用,并且效果很好。 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. 因此,我做了一些研究,意识到我需要为不包含TLD的jar设置jarsToSkip属性。 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. 我一直在研究如何查找导致问题的jar,但是运气不好,tomcat7-maven-plugin并没有传递输出jar名称所需的loggersettings。

Also I do not know where I set the jarsToSkip property when I have found the jars. 当我找到罐子时,我也不知道在哪里设置jarsToSkip属性。

Any help would be appreciated. 任何帮助,将不胜感激。

Believe the property jarsToSkip is a "catalina.properties" entry. 相信属性jarsToSkip是一个“ catalina.properties”条目。 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 conf文件夹中的任何地方,都查看文件“ catalina.properties”,并且应该在第90行左右看到这样的属性:

tomcat.util.scan.DefaultJarScanner.jarsToSkip=\

You should be able to add jars to that list to prevent them from being scanned. 您应该能够将jar添加到该列表,以防止对其进行扫描。

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. 使用Tomcat 7 Maven插件时,原本要放在catalina.properties中的所有内容都可以放在插件配置中。 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. 2.2(即2.0)之前的maven tomcat插件似乎存在一个错误,其中<systemProperties>似乎没有传播。 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). 同样在2.2了一个名为<jarScanAllDirectories>的配置选项,它似乎可以进一步提高性能(我认为它会忽略WEB-INF / <jarScanAllDirectories> )。

Ignoring port and path I found the following configuration to greatly improve Maven Tomcat performance. 忽略端口和路径,我发现以下配置可以大大提高Maven Tomcat的性能。

        <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 有一个打开的错误@ https://github.com/psi-probe/psi-probe/issues/348

Just pointing out. 只是指出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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