我还没做完 file.encoding and ant . 我如何设置 文件编码 朱尼特 ant任务不支持 编码 属性像 爪哇语
我尝试运行ant-Dfile.encoding=UTF-8和ant_OPTS=“-Dfile.encoding=UTF-8”ant,但没有成功。测试中的System.getProperty(“file.encoding”)仍然返回 .
JUnit支持子元素 <jvmarg ...> 它应该做你想做的。
<jvmarg ...>
<junit fork="yes"> <jvmarg value="-Dfile.encoding=UTF-8"/> ... </junit>
我猜你用的是 fork=yes 属性,因为这将为测试运行启动一个新的JVM,因此在命令行将参数发送到ant中 ant -Dfoo=bar 不一定传播到运行测试的JVM。
fork=yes
ant -Dfoo=bar