Maven:如何配置native2ascii-maven-plugin
我向你们解雇这个问题,因为项目页面本身并没有太多的信息。 基本上我设置native2ascii-maven-plugin来处理我的一些资源。 它适用于处理根目录中的文件。 但现在我有子目录下的文件: /template/email/
并希望它们包含在处理中。 你能帮帮我吗?
org.codehaus.mojo native2ascii-maven-plugin 1.0-alpha-1 target/resources src/main/resources native2ascii-utf8 native2ascii UTF8 ApplicationResources*.properties, errors.properties, /template/email/newBooking*.ftl
谢谢一堆!
您需要为要处理的每个文件夹定义执行部分,并将src和dest移动到执行部分:
org.codehaus.mojo native2ascii-maven-plugin 1.0-alpha-1 native2ascii-utf8-resources native2ascii target/resources src/main/resources UTF8 ApplicationResources*.properties, errors.properties, /template/email/newBooking*.ftl native2ascii-utf8-email native2ascii target/resources/email src/main/templates/email UTF8
这里是“native2ascii”的解决方案。 在src/main/locale
中找到的所有文件(递归地)都指向target/classes
:
[...] org.codehaus.mojo native2ascii-maven-plugin 1.0-alpha-1 native2ascii UTF8 src/main/locale target/classes [...]
以下是版本1.0-beta-1的示例配置:
org.codehaus.mojo native2ascii-maven-plugin 1.0-beta-1 native2ascii-utf8-resources process-classes native2ascii src/main/resources UTF8 ${basedir}/temp **/*_fa.properties
如果出现错误,您可以在此处查看插件源代码。
我最近创建了另一个版本的native2ascii maven插件,它涵盖了旧版本的使用,还包含m2e Eclipse插件使用的XML文件: https : //github.com/dmatej/native2ascii/releases
我必须强迫某人把它放到官方的maven存储库中……但是你仍然可以在自己的库中使用它。
1.0-beta-1的缺点是使用workDir的方法。 我不想在每个构建中更改我的源代码,但我仍然需要一些工具来为我的属性文件提供unicode anotation。
所以我用两个配置解决了这个问题:
- 将workDir设置为项目的目标;
-
在流程资源之后将阶段更改为某些内容;
org.codehaus.mojo native2ascii-maven-plugin 1.0-beta-1 native2ascii-utf8-i18n compile native2ascii target/classes/i18n ${project.build.sourceEncoding} **/*.properties
我使用阶段’编译’,因为IDE内部是我最常用的。
以下是2.0+版本的示例配置
org.codehaus.mojo native2ascii-maven-plugin 2.0.1 native2ascii-utf8-properties process-resources inplace ${project.build.directory}/classes **/*.properties UTF-8