java - Maven Cargo Tomcat 7 server.xml 被覆盖

标签 java jakarta-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> 

最佳答案

我遇到了类似的问题。我用过<configfiles>而不是<files> ,这就成功了。

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

关于java - Maven Cargo Tomcat 7 server.xml 被覆盖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14608221/

相关文章:

java - 如何从服务器向客户端发送消息

java - Spring Boot ErrorController 无法与 OpenShift 一起使用

java - JFileChooser 未在 tomcat 服务器上打开,但在使用 eclipse 运行时打开

java - 计算器:无法在主 GUI 的弹出窗口中使用 ActionListener

java - 从一个类的数组列表中获取要在另一个类中使用的元素

java - 在 Beanshell 解释器中执行循环

java - 如何从远程主机访问 Glassfish V3 管理控制台网站

apache - Tomcat Manager 能否在替代路径上安全运行?

java - Android SQLite 按频率排序条目而不分组

java - 为什么 struts 资源包具有 myresource.properties 和 myresource_en.properties 文件