Maven Cargo Tomcat7正在覆盖server.xml

时间:2013-01-30 15:57:54

标签: java java-ee tomcat7 maven-3 maven-cargo

我正在尝试使用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> 

1 个答案:

答案 0 :(得分:2)

我遇到了类似的问题。我使用<configfiles>代替<files>,这就是诀窍。

请参阅:http://cargo.codehaus.org/Configuration+files+option