如何使用buildr将html文件打包成jar/war?
我正在开发一个嵌入式 Jetty + Wicket 应用程序,并且正在使用 buildr。目前,Buildr 未将 HTML 文件(位于主源文件夹中,与我的 *.java 文件一起)包含在 jar 中。我如何告诉构建器将它们包含在编译/打包步骤中?
感谢您的建议,我想我已经很接近了。也许我应该问的问题是如何将 .HTML 文件放入 target/classes/ 子目录中的正确位置?我已经确认,如果我可以在 target/classes 文件夹中获取 .html 文件,则 package(:jar) 会将它们存档。我要开始看看这个。
I'm working on an embedded Jetty + Wicket app and I'm using buildr. Right now, Buildr isn't including the HTML files (which are in the main source folder, alongside my *.java files) in the jar. How can I tell buildr to include them in the compilation/package step?
Thanks for the suggestions, I think I'm close. Maybe the question I should be asking is how to get the .HTML files into the right place in the target/classes/ subdirectory? I've confirmed that if I can get the .html files in the target/classes folder, package(:jar) archives them. I'm going to start looking at that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
听起来您想要做的就是将 java 源路径视为资源路径。这是我如何做到这一点在一个已经相当大的项目中,我将其转换为 buildr:
这会将 *.html 文件放入
target/resources
中,然后将它们添加到包中。It sounds like what you want to do, then, is treat the java source paths as resource paths. Here's how I do that in a project I converted to buildr after it was already pretty large:
This will put the *.html files in
target/resources
and from there they will be added to the package.Buildr 将 src/main/webapp 文件夹中的内容作为 war 文件内容。您需要将 html 文件保留在其中。
Buildr take contents in src/main/webapp folder for war file contents. You need to keep the html files inside that.
这取决于它们需要到达 WAR 中的哪个位置,但通常您可以执行以下操作:
:war
包是:jar
包的特化,它是:zip
包的专门化,因此您可以使用任何记录的方法< /a> 也适用于:jar
或:war
上的:zip
。It depends on where in the WAR they need to go, but generally you can do something like this:
The
:war
package is a specialization of the:jar
package, which is a specialization of the:zip
package, so you can use any of the documented methods for:jar
or:zip
on a:war
, too.