I'm developing a web application using Eclipse Juno and Maven-WTP plugin. This application has a header image and I also have two Maven profiles. Those profiles permit changing the header image, because they point to a different directory, where the image is located. That's how they are configured:
<profile>
<id>local</id>
<properties>
<imagen.cabecera.dir>src/main/resources/styles/headers/example1</imagen.cabecera.dir>
</properties>
</profile>
<profile>
<id>local2</id>
<properties>
<imagen.cabecera.dir>src/main/resources/styles/headers/example2</imagen.cabecera.dir>
</properties>
</profile>
The idea is when I change the active profile in my .m2/settings.xml to have the header file changed as well. The active profile is configured like that:
<activeProfiles>
<!--make the profile active all the time -->
<activeProfile>nexus</activeProfile>
<activeProfile>local</activeProfile>
</activeProfiles>
If I change the active profile and do mvn clean install
everything works like a charm in project's target directory. However, the problem comes with Maven-WTP plugin. This plugin is taking the file from webapp/images
directory, and looks like when I change the active profile is not getting the new one. It seems the WTP plugin is not updating the file here, so I get the old one displayed in the browser, even I do a clean install
. This is my pom.xml configuration:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
<resources>
<resource>
<directory>${imagen.cabecera.dir}</directory>
<includes>
<include>cabecera.jpg</include>
</includes>
<targetPath>${project.build.directory}/header</targetPath>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<executions>
<execution>
<id>default-war</id>
<configuration>
<webResources>
<resource>
<directory>${project.build.directory}/header</directory>
<includes>
<include>cabecera.jpg</include>
</includes>
<targetPath>/images</targetPath>
</resource>
</webResources>
</configuration>
</execution>
</executions>
</plugin>
Does anybody know about that?