Below is the relevant section of the maven project I'm working on. I would like Maven to filter the persistence-context.xml file inside of the WEB-INF directory, and then place it into the WEB-INF directory inside of my war. When I run mvn clean package on this project I see the following two things.
The successfully filtered persistence-context.xml in the target/projectname/ folder. This is NOT the correct place. I want it one directory up in the WEB-INF.
The unfiltered persistence-context.xml in the target/projectname/WEB-INF/ folder. This is NOT what I want. I want the filtered one here.
I'm not even sure how two copies of this file are being generated! Any help would be much appreciated.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<webResources>
<resource>
<directory>${basedir}/src/main/webapp/WEB-INF</directory>
<filtering>true</filtering>
<includes>
<include>persistence-context.xml</include>
</includes>
<targetPath>WEB-INF</targetPath>
</resource>
</webResources>
</configuration>
</plugin>
I realized I had another plugin entry for the war plugin which was interfering (possibly overwriting?) with this one. Once I removed that my above entry worked okay!