美文网首页
使用freemarker生成静态文件踩坑记录

使用freemarker生成静态文件踩坑记录

作者: 菜菜___ | 来源:发表于2020-02-08 11:58 被阅读0次

使用freemarker生成静态文件时本地可以正常生成,发布到线上却没有生成文件也没有报错,后来发现线上项目里有两个freemarker.jar包,编译器默认使用版本低的包,而代码里却是使用的高版本jar包,导致没有生成文件。

Configuration configuration = new Configuration(Configuration.VERSION_2_3_28);
configuration.setDirectoryForTemplateLoading(new File(ftlPath));
configuration.setDefaultEncoding("UTF-8");
Template template = configuration.getTemplate("news_detail.ftl");

解决办法:删除低版本的jar包。
原文作者技术博客:https://www.jianshu.com/u/ac4daaeecdfe

相关文章

网友评论

      本文标题:使用freemarker生成静态文件踩坑记录

      本文链接:https://www.haomeiwen.com/subject/faxixhtx.html