Maven jar-with-dependency log4j [英] maven jar-with-dependencies log4j
问题描述
我正在使用maven构建具有依赖关系的可执行jar.我的应用程序使用log4j,并且在src/resources下有一个适当的log4j.properties文件.
I'm building an executable jar-with-dependencies using maven. My application uses log4j and there's an appropriate log4j.properties file under src/resources.
我的问题是周围还有其他log4j.properties文件,因此当maven构建具有依赖关系的jar时,它会抓住其中一个而不是我想要的一个,并跳过由于log4j而找到的其他任何文件.properties已包含在内.
My problem is that there are other log4j.properties files floating around so when maven builds the jar-with-dependencies, it's grabbing one of those instead of the one I want it to, and skipping any others it finds due to log4j.properties already being included.
有人知道解决这个问题的方法吗?
Anyone know of a way around this?
推荐答案
根据jar-with-dependencies 的文档,这是一个非常生硬的工具.为了更好地控制,请使用Maven-shade-plugin,在其中可以排除所有不需要的文件.
As per the documentation of jar-with-dependencies, it is a very blunt instrument. For better control, use the maven-shade-plugin, where you can exclude all those unwanted files.
这篇关于Maven jar-with-dependency log4j的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!