Stepan Vavra created MTOMCAT-281:
------------------------------------
Summary: It is impossible to override 9 system properties that are
packed within
totomcat-embed-core-7.0.47.jar!/org/apache/catalina/startup/catalina.properties
Key: MTOMCAT-281
URL: https://issues.apache.org/jira/browse/MTOMCAT-281
Project: Apache Tomcat Maven Plugin
Issue Type: Bug
Components: tomcat7
Affects Versions: 2.2
Environment: all
Reporter: Stepan Vavra
Assignee: Olivier Lamy (*$^¨%`£)
Priority: Minor
It is impossible to override following properties
* {{package.access}}
* {{package.definition}}
* {{common.loader}}
* {{server.loader}}
* {{shared.loader}}
* {{tomcat.util.scan.DefaultJarScanner.jarsToSkip}}
* {{org.apache.catalina.startup.ContextConfig.jarsToSkip}}
* {{org.apache.catalina.startup.TldConfig.jarsToSkip}}
* {{tomcat.util.buf.StringCache.byte.enabled}}
from tomcat7 maven plugin configuration.
The reason is that code in
{{org.apache.catalina.startup.CatalinaProperties#loadProperties()}} blindly
overrides all system properties with properties from
{{totomcat-embed-core-7.0.47.jar!/org/apache/catalina/startup/catalina.properties}}
by default. As a result following tomcat7 maven plugin configuration is not
used: {code}
<systemProperties>
<org.apache.catalina.startup.ContextConfig.jarsToSkip>my-other-jar-to-skip.jar</org.apache.catalina.startup.ContextConfig.jarsToSkip>
</systemProperties>{code}
which is a convenient way to adjust startup performance of Tomcat (which is
poor due to Servlet Spec 3.0 requirements to scan all classes).
I suggest either
* to call
{{org.apache.tomcat.maven.plugin.tomcat7.run.AbstractRunMojo#setupSystemProperties()}}
(which applies system properties from maven plugin configuration) after
{{org.apache.catalina.startup.CatalinaProperties.getProperty()}} (which applies
system properties from tomcat embedded catalina.properties file) in method
{{org.apache.tomcat.maven.plugin.tomcat7.run.AbstractRunMojo#startContainer()}}
and not the other way around; or
* to modify {{org.apache.catalina.startup.CatalinaProperties#loadProperties()}}
and to check whether a particular System property already exists
There is also a workaround which prevents the embedded Tomcat from loading the
default {{catalina.properties}} file:
{code}
<systemProperties>
<catalina.config>${project.baseUri}/target/tomcat/logs</catalina.config>
<!-- or use any other path which results in an empty set of properties
-->
</systemProperties>
{code}
In such case, system properties specified from command line or maven plugin
configuration are used.
If desired, I can provide you with a pull request or a patch in order to make
it more easy for you.
Thanks,
Stepan
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]