@laywee 修复自动代码生成时有时乱码导致maven无法正常打包的问题

This commit is contained in:
shuzheng 2017-05-04 22:05:11 +08:00
parent ed12d88568
commit e63f94dc3f
1 changed files with 2 additions and 2 deletions

View File

@ -1,5 +1,6 @@
package com.zheng.common.util;
import org.apache.commons.io.output.FileWriterWithEncoding;
import org.apache.commons.lang.StringUtils;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
@ -7,7 +8,6 @@ import org.apache.velocity.app.Velocity;
import org.apache.velocity.app.VelocityEngine;
import java.io.File;
import java.io.FileWriter;
import java.util.Properties;
/**
@ -31,7 +31,7 @@ public class VelocityUtil {
//VelocityEngine engine = new VelocityEngine();
Template template = Velocity.getTemplate(getFile(inputVmFilePath), "utf-8");
File outputFile = new File(outputFilePath);
FileWriter writer = new FileWriter(outputFile);
FileWriterWithEncoding writer = new FileWriterWithEncoding(outputFile, "utf-8");
template.merge(context, writer);
writer.close();
} catch (Exception ex) {