I\'m trying to filter a Spring configuration file using Maven filtering. My POM is configured like this:
...
Well, finally I got it.
First of all, I did what khmarbaise pointed out. I moved applicationContext.xml
to the resources folder. War plugin webResources are meant to work with external resources, and filtering a file in the destination folder itself was not the best practice.
I updated the POM to reflect the new configuration
src/main/resources
true
and
org.apache.maven.plugins
maven-war-plugin
2.2
true
WEB-INF/context
src/main/resources/WEB-INF/context
applicationContext.xml
So, half of the credit to him.
But that's was not enough, it still didn't work.
I realized that Maven/m2e was indeed filtering my file, but it didn't get my defined properties files. After some testing I found out that m2e is ignoring the activeByDefault
option in the profiles activation section.
So, I added my default profile to the project Maven configuration and then it worked