6、maven依赖的传递性和依赖的排除

6.1、依赖的传递性

  记住一条重要的规则:非compile范围的依赖不能传递。

  优点:可以传递的依赖不必在每个工程模块中都重复声明。

6.2、依赖的排除

<dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-core</artifactId>
      <version>4.3.6.RELEASE</version>
      <exclusions>
        <exclusion>
          <groupId>commons-logging</groupId>
          <artifactId>commons-logging</artifactId>
        </exclusion>
    </exclusions>
</dependency> //spring-core默认依赖了commons-logging作为底层日志,但我们并不想使用它默认的底层日志,
//这个时候可以使用<exclusions><exclusion>进行排除。

猜你喜欢

转载自www.cnblogs.com/sunhao1234/p/12709762.html