我正在尝试使用 Maven 运行我们的集成测试。它将 catalina-base 部署到正确的目录,并使用 catelina-home 设置为 Tomcat7 的本地安装来运行。
但是,copy/configfile 命令不适用于 server.xml。已正确复制 tomcat-users.xml,但未正确复制 server.xml。知道为什么会发生这种情况吗? 请参阅下面的 pom.xml:
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
<deployables>
<deployable>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<type>war</type>
</deployable>
</deployables>
<container>
<containerId>tomcat7x</containerId>
<home>${catalina-home}</home>
<type>installed</type>
</container>
<configuration>
<home>${project.build.directory}/catalina-base</home>
<type>standalone</type>
<files>
<copy>
<configfile>true</configfile>
<file>server.xml</file>
<tofile>conf/server.xml</tofile>
<overwrite>true</overwrite>
</copy>
<copy>
<configfile>true</configfile>
<file>tomcat-users.xml</file>
<tofile>conf/tomcat-users.xml</tofile>
<overwrite>true</overwrite>
</copy>
</files>
</configuration>
</configuration>
<executions>
<execution>
<id>tomcat-run</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>tomcat-shutdown</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
最佳答案
我遇到了类似的问题。我用过<configfiles>
而不是<files>
,这就成功了。
关于java - Maven Cargo Tomcat 7 server.xml 被覆盖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14608221/