【发布时间】:2020-09-04 07:47:14
【问题描述】:
我们的应用程序有一个资源包,我们需要将变音符号写成转义的 unicode 值(\u00f6 表示 ö)。
因为对于某些构建,我们需要不同的文本,并且为了不必复制其他 maven 配置文件的所有资源文件,我添加了一个 maven 过滤器文件,它将相应的文本放入资源包属性文件( webResources 的 Maven 战争插件)。这很好用,除了在过滤期间 maven 将我的 \u00f6 转换为 ö 并因此破坏了我们的资源包。
mylan.properties:
myMessage.title=${myProperty.to.replace}
-> 使用 filter.properties 过滤:
myProperty.to.replace=只显示一些\u00f6。
-> 结果:
myMessage.title=只显示一些ö。
但应该是:
myMessage.title=只显示一些\u00f6。
如何告诉 maven 在过滤 webResources 期间不要进行此替换?
感谢您的任何提示!
奥雷尔
这是我用于打包的 maven 配置:
<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>
【问题讨论】:
标签: maven filtering resourcebundle unicode-escapes