检索Maven的jar包的依赖

比如 log4j-over-slf4j 和 slf4j-log4j12 冲突

  • slf4j-log4j12的groupId是org.slf4j
  • slf4j-log4j12的artifactId是slf4j-log4j12
mvn dependency:tree -Dverbose -Dincludes=org.slf4j:slf4j-log4j12

解决

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<dependency> 
  <groupId>org.apache.zookeeper</groupId>  
  <artifactId>zookeeper</artifactId>  
  <version>3.4.8</version>  
  <exclusions> 
    <exclusion> 
      <groupId>org.slf4j</groupId>  
      <artifactId>slf4j-log4j12</artifactId> 
    </exclusion>  
    <exclusion> 
      <groupId>log4j</groupId>  
      <artifactId>log4j</artifactId> 
    </exclusion> 
  </exclusions> 
</dependency>