yostane
yostane

Reputation: 383

maven eclipse wtp not putting custom <webxml> file in WEB-INF folder

When i deploy a webapp using eclipse wtp, the custom "webxml" file specified in pom.xml is not copied to WEB-INF folder as 'web.xml' . However the file is correctly copied in the war in the WEB-INF folder.

Here is the snippet from pom.xml

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.1.1</version>
    <configuration>
        <webXml>${webXmlPath}</webXml>
        <packagingExcludes>WEB-INF/web.xml</packagingExcludes>
    </configuration>
</plugin>

${webXmlPath} depends on the profile and has a default value:

<properties>
        <webXmlPath>${basedir}/src/main/webapp/WEB-INF/web-embed.xml</webXmlPath>
</properties>

thanks :)

Upvotes: 2

Views: 1544

Answers (1)

Fred Bricon
Fred Bricon

Reputation: 5579

If you use m2e-wtp, your /.settings/org.eclipse.wst.common.component should contain an entry like :

<wb-resource deploy-path="/WEB-INF/web.xml" source-path="/src/main/webapp/WEB-INF/web-embed.xml"/>

That should do the trick.

Now for server adapters which support it (currently JBoss AS only), using <packagingExcludes>WEB-INF/web.xml</packagingExcludes> will actually prevent any web.xml from being deployed. Other server adapters (like Tomcat) will ignore that directive.

Upvotes: 1

Related Questions