1
我正在使用貨物來自動化Tomcat上的戰爭部署。但是,我遇到了麻煩:我無法用我的自定義替換默認的tomcat文件,因爲我的文件先被複制,然後在默認情況下被覆蓋。我花了幾個小時來解決這個問題,但沒有任何工作。這是我的pom.xml貨物嵌入式tomcat:定製context.xml
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>replace-tomcat-users-xml</id>
<phase>process-test-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/apache-tomcat-${version.tomcat}/conf/</outputDirectory>
<resources>
<resource>
<directory>src/test/resources/</directory>
<includes>
<include>context.xml</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>replace-tomcat-users-xml-cargo</id>
<phase>process-test-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/cargo/installs/tomcat-${version.tomcat}/apache-tomcat-${version.tomcat}</outputDirectory>
<resources>
<resource>
<directory>src/test/resources/</directory>
<includes>
<include>context.xml</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
這裏是貨物使用:
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.4.11</version>
<configuration>
<skip>false</skip>
<container>
<containerId>tomcat7x</containerId>
<log>${project.build.directory}/cargo.log</log>
<artifactInstaller>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat</artifactId>
<version>${version.tomcat}</version>
<type>zip</type>
</artifactInstaller>
<systemProperties>
<tomcat.home.dir>
${basedir}/target/cargo/installs/apache-tomcat-${version.tomcat}/apache-tomcat-${version.tomcat}
</tomcat.home.dir>
<tomcat.server.home.dir>
${basedir}/target/cargo/installs/apache-tomcat-${version.tomcat}/apache-tomcat-${version.tomcat}
</tomcat.server.home.dir>
</systemProperties>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
</dependencies>
</container>
<configuration>
<configfile>
<file>${basedir}/target/cargo/installs/context.xml</file>
<todir>conf/</todir>
<tofile>context.xml</tofile>
<configfile>true</configfile>
<overwrite>true</overwrite>
</configfile>
<properties>
<cargo.servlet.port>8080</cargo.servlet.port>
<!--Тут менять-->
<cargo.servlet.users>admin:admin:manager-script</cargo.servlet.users>
<cargo.jvmargs>
-Xmx1024m -XX:MaxPermSize=512m
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
-Xnoagent
-Djava.compiler=NONE
</cargo.jvmargs></properties>
</configuration>
我看到,我沒有在這裏標記但我做到了,所以不exxt找到錯誤在這裏。主要的問題是嵌入式tomcat複製後,然後我的自定義文件,並覆蓋它們。 –
quento