0

We have for our application a resource bundle where we need the umlauts written as escaped unicode values (\u00f6 for ö).

Because for some builds, we need different texts and in order to not have to copy all the resource file for the other maven profile, I have added a maven filter file, that places the corresponding text into the resource bundle property file (webResources of the maven war plugin). This works very well except that during filtering maven transforms my \u00f6 to ö and thus breaks our resource bundle.

mylan.properties:
myMessage.title=${myProperty.to.replace}

-> filter with filter.properties:
myProperty.to.replace=Just some \u00f6 to show.

-> result:
myMessage.title=Just some ö to show.

but should be:
myMessage.title=Just some \u00f6 to show.

How can I tell maven to NOT do this replacement during filtering webResources?

Thanks for any hint!
Aurel

This is my maven config for packaging:

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-war-plugin</artifactId>
                        <version>3.0.0</version>
                        <configuration>
                            <classifier>XYZ</classifier>
                            <warName>${project.artifactId}${svn_revision.padded}</warName>
                            <filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
                            <filters>src/main/config/filter.properties</filters>
                            <webResources>
                                ...
                                <resource>
                                    <!-- needs to be here because of env dependent filtering -->
                                    <filtering>true</filtering>
                                    <directory>src/main/resources</directory>
                                    <targetPath>WEB-INF/classes</targetPath>
                                </resource>
                                ...
                            </webResources>
                        </configuration>
                    </plugin>
Aurelius Baier
  • 121
  • 1
  • 6

1 Answers1

1

It looks like you want the maven-war-plugin's escapeString configuration setting.

Laird Nelson
  • 15,321
  • 19
  • 73
  • 127
  • 1
    Yes, this was the point. I missed that one. In the end I had to prefix every unicode charachter with the escape character: `\\u00e0` instead of `\u00e0` for 'à' in the property to replace. Thank you very much! – Aurelius Baier Sep 09 '20 at 08:18