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

Ris*_*edi 5 maven

我的 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>
Run Code Online (Sandbox Code Playgroud)

我收到的警告:

[警告] 在 [org.apache.hadoop:hadoop-core:2.XXX,org.apache.hbase:hbase-test:2-XXX] 中发现重复资源:[警告] log4j.properties

Ran*_*ler 0

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)
Run Code Online (Sandbox Code Playgroud)