在 Maven 构建期间将文件添加到 jar
我有一个 xslt,想在执行 Maven 构建时将其添加到我的 jar 文件中。我阅读了文档,您可以在资源文件夹中添加内容,它会被拾取,但是如果我希望它显示在不同的文件夹中怎么办 - 我如何让它在 jar 中出现?
I have an xslt that I want to add to my jar file when I do the maven build. I read int he documentation you can add stuff in the resources folder, and it will get picked up, but what if I want it to show up in a different folder - how do I make it go there in the jar?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果它是一个 JAR,只需将其添加到
src/main/resources
中,复制您想要出现在 JAR 中的文件夹结构(JAR 的类路径根是它的第一级,因此很容易) 。对于 WAR 或其他包类型,方法非常不同
If it's a JAR just add it in
src/main/resources
replicating the folder structure you want to be present in the JAR (the classpath root for a JAR is the very first level on it so it's easy).In case of a WAR or other package types the method is very different