如何将 auto_import 功能与 FreeMarker 和 maven 或 ant(不是 servlet)一起使用

发布于 2024-11-28 22:12:10 字数 169 浏览 2 评论 0原文

我想测试使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

苦笑流年记忆 2024-12-05 22:12:10

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 use auto_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

高速公鹿 2024-12-05 22:12:10

您尝试过 FMPP 吗?

FMPP 是一种使用 FreeMarker 模板的通用文本文件预处理器工具。

它可以通过命令行或 Ant 使用,并且可能提供您需要的所有功能。

Have you tried FMPP?

FMPP is a general-purpose text file preprocessor tool that uses FreeMarker templates.

It can be used via command-line or Ant and might provide all the features you need.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文