I would like to have two different web.xml
descriptor files in my maven project. First (default) should be included in war file for deployment to application server and second should be used for development using tomcat7-maven-plugin:run
. I know there is <tomcatWebXml>
parameter but it specifies Tomcat global web.xml
which I don't want to change.
For jetty-maven-plugin:run
I can specify either <webApp>/<descriptor>
or <webApp>/<overrideDescriptor>
. First replaces default web.xml
with specified file while second applies specified file content in addition to default web.xml
.
Is there some possibility how to achieve same functionality with tomcat7-maven-plugin
?
It is an old question, but I will write this here in case anyone else is looking.
Yes, it is possible.
You can do this by overriding the default (built-in) war-builder that tomcat7-maven-plugin uses, which is org.apache.maven.plugins:maven-war-plugin
The override is done by simply adding that plugin to your pom.xml, along with the extra configuration webXml
The code will look like this
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
<webXml>myPath/web.xml</webXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
... other configurations here
</configuration>
</plugin>
...
</plugins>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With