I'm looking at the way to get a redirection of resources in my webapp depending on the Operating System. I wanted to change the path of some resources depending on whether you use windows or linux because there are people on the team who use both and it is inefficient to comment and uncomment. But I have found an error that I am not able to solve, I am surely doing something very wrong:
Replacement target file (src/main/resources/context/mvc.xml):
<mvc:resources mapping="/photos/*" location="${file.mapping}"></mvc:resources>
maven profile:
<profile>
<id>dos</id>
<activation>
<os>
<family>dos</family>
</os>
</activation>
<properties>
<file.mapping>file:///C:/software/photos/</file.mapping>
</properties>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
</profile>
Recurring error:
Could not resolve placeholder 'file.mapping' in value "${file.mapping}"
In the latest versions of Spring they have created their own profiles that you can choose at runtime (all profiles are compiled at the same time). This caused problems with Maven and the solution is that Maven variables are used with the ${...} notation inside the pom.xml file, but with
@...@
in the files.I think if you put
It should work