如何在 ant 的 build.xml 中设置 -Dfile.encoding? [英] How do I set -Dfile.encoding within ant's build.xml?
本文介绍了如何在 ant 的 build.xml 中设置 -Dfile.encoding?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有 iso-8859-1 编码的 java 源文件.当我运行 ant 时,我收到警告:编码 UTF-8 的不可映射字符".如果我运行 ant -Dfile.encoding=iso-8859-1 或将 encoding="ISO-8859-1" 添加到每个 javac 语句中,我可以避免这种情况.>
有没有办法在 build.xml 中全局设置属性?
I've got java source files with iso-8859-1 encoding. When I run ant, I get "warning: unmappable character for encoding UTF-8". I can avoid this if I run ant -Dfile.encoding=iso-8859-1 or add encoding="ISO-8859-1" to each javac statement.
推荐答案
几个选项:
- 将
-Dfile.encoding=iso-8859-1
添加到您的ANT_OPTS
环境变量 - 使用
A few options:
add -Dfile.encoding=iso-8859-1
to your ANT_OPTS
environment variable
use <presetdef>
to setup defaults for all of your <javac>
invocations
这篇关于如何在 ant 的 build.xml 中设置 -Dfile.encoding?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文