简体   繁体   English

在maven构建期间将文件添加到jar

[英]Add file to jar during maven build

I have an xslt that I want to add to my jar file when I do the maven build. 当我进行maven构建时,我有一个xslt,我想添加到我的jar文件中。 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? 我在文档中读到你可以在资源文件夹中添加内容,它会被拾取,但如果我希望它出现在另一个文件夹中怎么办 - 如何让它在jar中去?

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). 如果它是一个JAR,只需将它添加到src/main/resources复制你想要出现在JAR中的文件夹结构(JAR的类路径根是它的第一级,所以很容易)。

In case of a WAR or other package types the method is very different 在WAR或其他包装类型的情况下,该方法是非常不同的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM