Maven:从依赖项中排除 log4j.properties



我的pom.xml文件有2个依赖项,它们都有log4j.properties文件。有没有办法排除依赖项中的文件?

使用此插件无济于事:

       <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.3</version>
            <configuration>
                <excludes>
                    <exclude>**/log4j.properties</exclude>
                </excludes>
            </configuration>
        </plugin>

我收到的警告:

[警告] 在 [org.apache.hadoop

:hadoop-core:2.XXX,org.apache.hbase:hbase-test:2-XXX] 中发现重复的资源:[警告] 日志4j.属性

1. go to your pom choose Dependency Hierarchy tab
2.enter the jar name you want (log4j)
3.see if they are at the same version (you are expecting more then one)
4.exclude whatever you don't need (you can right click to exclude)

最新更新