reportng1.1.4中文乱码
1.下载reportng源码
git clone https://github.com/dwdyer/reportng.git
2.修改AbstractReporter.java
把原来的注释掉,改成如下的
package org.uncommons.reportng;
...
import java.io.OutputStream;
...
protected void generateFile(File file,
String templateName,
VelocityContext context) throws Exception
{
//Writer writer = new BufferedWriter(new FileWriter(file));
//encoding to utf-8
OutputStream out = new FileOutputStream(file);
Writer writer = new BufferedWriter(new OutputStreamWriter(out,"utf-8"));
try
{
Velocity.mergeTemplate(classpathPrefix + templateName,
ENCODING,
context,
writer);
writer.flush();
}
finally
{
writer.close();
}
}
3、把整个reportng文件导入到eclipse中
4、在eclipse中导出为jar文件(取名为reportng-1.1.4)
5、找到原来的maven仓库下的reportng1.1.4,替换掉
6、重新基于套件运行,查看网页报告,无中文乱码了
更多推荐
所有评论(0)