如何将 auto_import 功能与 FreeMarker 和 maven 或 ant(不是 servlet)一起使用
我想测试使用 freemarker 在编译时自动构建我的 html 文件(不使用 servlet),并希望使用 auto_import 功能,这样我就不必为每个文件重新定义模板。我可以使用 ANT 或 Maven。如何使用 auto_import 功能通过 ANT 或 Maven 在 FreeMarker 中自动加载模板?
I'd like to test using freemarker to automatically build my html files at compile time (not use the servlet) and want to use the auto_import feature so I don't have to re define the template for each file. I can either use ANT or Maven. How do you use the auto_import feature to automatically load templates within FreeMarker using either ANT or Maven?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
auto_imports
只是众多 FreeMarker 设置之一,它与 servlet、Maven 或 Ant 无关。因此,如果您可以使用 Ant 或 Maven 处理文件(一种方法是使用 Maven FMPP 插件或 Ant FMPP 任务),那么您也应该能够使用auto_imports
。更新: FMPP 有一个问题(直到 0.9.15 发布):它不知道此设置,因此您无法通过 FMPP 进行设置。但它有“页眉和页脚选择”,这更加灵活。请参阅:http://fmpp.sourceforge.net/settings.html
auto_imports
is just one of the many FreeMarker settings, and it has nothing to do with servlets, Maven or Ant. So if you can process the files with Ant or Maven (one way is using the Maven FMPP plugin or the Ant FMPP task), then you should be able to use useauto_imports
as well.Update: There's an issue with FMPP (until 0.9.15 is released): it doesn't know this setting, so you can't set it through FMPP. But instead it has "Header and footer choosing", which is even more flexible. See: http://fmpp.sourceforge.net/settings.html
您尝试过 FMPP 吗?
它可以通过命令行或 Ant 使用,并且可能提供您需要的所有功能。
Have you tried FMPP?
It can be used via command-line or Ant and might provide all the features you need.