我有iso-8859-1编码的java源文件.当我运行ant时,我得到"警告:编码UTF-8的不可映射的字符".如果我运行ant -Dfile.encoding = iso-8859-1或者将encoding ="ISO-8859-1"添加到每个javac语句中,我可以避免这种情况.
有没有办法在build.xml中全局设置属性? <property name ="file.encoding"value ="ISO-8859-1">不起作用.我知道我可以添加一个foo = ISO-8859-1属性并为每个javac语句设置encoding ="$ {foo}",但我试图避免这种情况.
我没有完成file.encoding和ant.如何在ant中为junit测试设置file.encoding?该JUnit的蚂蚁任务不支持的编码,如属性的javac任务一样.
我试过运行«ant -Dfile.encoding = UTF-8»和«ANT_OPTS =" - Dfile.encoding = UTF-8"ant»但没有成功.测试中的System.getProperty("file.encoding")仍返回MacRoman.