I have a problem with maven. i'm alredy using tomcat7-maven-plugin to deploy my war into a tomcat and it works great.
But now I would like to change a file into my generated war before to send it to servlet container. Is it possible? Particularly I want to change default web.xml with another one.
I've already tried a maven-resources-plugin as showed below:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.2</version>
<executions>
<execution>
<id>default-copy-resources</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<overwrite>true</overwrite>
<outputDirectory>${project.build.directory}/${project.artifactId}/WEB-INF/</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/src/main/webapp/ext/WEB-INF</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
but this plugin replace web.xml just on target WEB-INF folder, nothing will be changed into war file. Someone can help me to find the right plugin to achive my purpose?
UPDATE:
I resolved using this: https://stackoverflow.com/a/3298876/2148530
You can define your profile(in your pom.xml) within it you override the maven.war.webxml property :
<properties>
<maven.war.webxml>path/to/your/custom/web.xml</maven.war.webxml>
</properties>
Solution (not mine), taken from question Maven: Customize web.xml of web-app project with Maven War Plugin and webXml
parameter.
webXml The path to the web.xml file to use.
<profiles>
<profile>
<id>tomcat</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webXml>${project.basedir}/src/main/webapp/ext/WEB-INF/web.xml</webXml>
</configuration>
</plugin>
...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.