如何设置蚂蚁的build.xml内-Dfile.encoding? [英] How do I set -Dfile.encoding within ant's build.xml?

查看:170
本文介绍了如何设置蚂蚁的build.xml内-Dfile.encoding?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经得到了与ISO-8859-1编码Java源文件。当我运行的蚂蚁的,我得到警告:不可映射字符编码UTF-8。我能避免这一点,如果我跑的蚂蚁-Dfile.encoding = ISO-8859-1 的或添加的编码=ISO-8859-1的每个javac的声明。

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.

有没有办法来的build.xml全球范围内设置属性?的<属性名=file.encoding的VALUE =ISO-8859-1> 的不起作用。我知道我可以在富= ISO-8859-1性能和集编码=$ {} foo的添加到每个javac的说法,但我想避免这种情况。

Is there a way to set the property globally within build.xml? <property name="file.encoding" value="ISO-8859-1"> does not work. I know that I can add a foo=ISO-8859-1 property and set encoding="${foo}" to each javac statement, but I'm trying to avoid that.

推荐答案

有几个选项:


  1. 添加 -Dfile.encoding = ISO-8859-1 你的 ANT_OPTS 环境变量

  2. 使用&LT; presetdef&GT; 设置默认为您所有的&LT; javac的&GT; 调用

  1. add -Dfile.encoding=iso-8859-1 to your ANT_OPTS environment variable
  2. use <presetdef> to setup defaults for all of your <javac> invocations

这篇关于如何设置蚂蚁的build.xml内-Dfile.encoding?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆