Kotlin,解决依赖冲突

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/TopWilling/article/details/79061771

在项目中导入多个依赖时,如果多个依赖中包含相同的jar包,这时候,会出现依赖重复的问题,如何解决这个问题呢?

举个栗子:

  • compile(“commons-httpclient”,”commons-httpclient”,”3.1”)中包含logging的jar包:
    这里写图片描述

  • compile(“org.springframework”,”spring-webmvc”,”4.0.4.RELEASE”) 包含logging的jar包:

这里写图片描述

  • 两个库都拥有相同的loggjar包,但是版本不一样;如何解决重复jar包问题呢?这样:
    compile(“org.springframework”,”spring-webmvc”,”4.0.4.RELEASE”)
    {
    exclude(“commons-logging”)//不引用该logging.jar包.
    }

猜你喜欢

转载自blog.csdn.net/TopWilling/article/details/79061771