尤里卡!经过数天的研究,我终于找到了一个非常有效的解决方案。关键是获取Tomcat
XML上下文片段文件,并使用
<configfiles>cargo元素将其放入
conf/Catalina/localhost名称为的目录中
context.xml.default。唯一的缺点是,这将使您的上下文定义可用于所有Web应用程序,但这并不重要,仅Cargo使用此Tomcat实例,因此没有其他Web应用程序。
配置如下:
<configuration> <!-- Deployer configuration --> <type>standalone</type> <properties> <cargo.servlet.port>${tomcat6.port}</cargo.servlet.port> </properties> <deployables> <deployable> <groupId>com.myapp<groupId> <artifactId>myapp-war</artifactId> <type>war</type> <properties> <context>${tomcat6.context}</context> </properties> </deployable> </deployables> <configfiles> <configfile> <file>${basedir}/../config/tomcat-context.xml</file> <todir>conf/Catalina/localhost/</todir> <tofile>context.xml.default</tofile> </configfile> </configfiles></configuration>最终结果是不再有伪造的WAR模块仅用于测试,也不再合并WAR。希望这可以帮助到别人。



