Community
Participate
Working Groups
Created attachment 223915 [details] Example project I am having this problem using Eclipse Indigo with m2e 1.2.0.20120903-1050 and m2e-wtp 0.16.0.20120914-0945. My project has 1 overlay war and 9 other wars that use this overlay. Each final war defines some properties that have to be reflected on some of the overlay files. So on the final wars pom.xml I have something this: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.2</version> <configuration> [...] <overlays> <overlay> <groupId>org.test</groupId> <artifactId>overlay</artifactId> <filtered>true</filtered> </overlay> </overlays> [...] </configuration> </plugin> <dependencies> <dependency> <groupId>org.test</groupId> <artifactId>overlay</artifactId> <version>xxx</version> <type>war</type> </dependency> </dependencies> It works fine if I package from maven3 command line but deploying on tomcat7 using m2e-wtp I got the unfiltered properties on the files. Attached are example projects that shows the problem.
filtering war overlays in m2e-wtp is not supported, and given the current overlay implementation, I doubt it can be fixed without rewriting the everything. It'll definitely be non trivial to implement. The main problem is the incremental nature of the overlay support in WTP (changes in overlays are deployed incrementally on the server), which makes it difficult to cope with on the fly filtering, and the fact it's not coupled to maven. There's a workaround though, it's not pretty, but should work. Add the following m2e-wtp profile to your (final war) pom.xmls : <profiles> <profile> <id>m2e-wtp</id> <!-- workaround for lack of overlay filtering support in m2e-wtp You need to distinguish whether the overlay is a workspace project or an archive The filtered files will be copied to target/m2e-wtp/web-resources. Be aware that, in case of duplicates, filtered resources will supercede your project resources. --> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.2</version> <configuration> <failOnMissingWebXml>false</failOnMissingWebXml> <filteringDeploymentDescriptors>true</filteringDeploymentDescriptors> <webResources> <!-- workaround for lack of overlay support filtering case when the overlay is also a workspace project If you modify a file in the overlay project, you'll need to *touch* this pom.xml to trigger an filtering request. --> <resource> <directory>../overlay/src/main/webapp</directory> <includes> <!-- filtering must be limited to the relevant files only or else you might experience some performance penalty --> <include>*.html</include> </includes> <filtering>true</filtering> </resource> <!-- workaround for lack of overlay support filtering case when the overlay is an archive <resource> <directory>target/m2e-wtp/overlays/overlay-0.0.1/-SNAPSHOT</directory> <includes> <include>*.html</include> </includes> <filtering>true</filtering> </resource> --> <resource> <filtering>true</filtering> <directory>src/main/webapp</directory> <includes> <include>**/*.html</include> </includes> </resource> </webResources> <overlays> <overlay> <groupId>org.test</groupId> <artifactId>overlay</artifactId> <filtered>true</filtered> </overlay> </overlays> </configuration> </plugin> </plugins> </build> </profile> </profiles>
Bugzilla form
...atting sucks!
I recommend using JBoss Tools' Maven Profiles Management feature (http://docs.jboss.org/tools/whatsnew/maven/maven-news-3.3.0.M3.html#itemname1) installable from http://download.jboss.org/jbosstools/updates/development/juno/ to switch between maven profiles
I can see why it will be difficult to implement this... Anyway, thanx for you suggestion. It is not pretty but is better than replicating the files in all the modules. I'll try it.