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

查看:36
本文介绍了如何在 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 中全局设置属性? 不起作用.我知道我可以添加一个 foo=ISO-8859-1 属性并将 encoding="${foo}" 设置为每个 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.

推荐答案

几个选项:

  1. -Dfile.encoding=iso-8859-1 添加到您的 ANT_OPTS 环境变量
  2. 使用

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屋!

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