Gradle - SpringからCommons-Loggingを除外する

Gradle – Springからcommons-loggingを除外する

Springフレームワークからcommons-loggingを除外するGradleの例。

build.gradle

    compile('org.springframework:spring-webmvc:4.2.4.RELEASE'){
        exclude group: 'commons-logging', module: 'commons-logging'
    }

複数のSpring依存関係がある場合は、それぞれを除外する必要があります

build.gradle

    compile('org.springframework:spring-webmvc:4.2.4.RELEASE'){
        exclude group: 'commons-logging', module: 'commons-logging'
    }

    compile('org.springframework:spring-test:4.2.4.RELEASE'){
        exclude group: 'commons-logging', module: 'commons-logging'
    }

より良い解決策は、プロジェクトレベルでcommons-loggingを除外することです。

build.gradle

    configurations.all {
        exclude group: "commons-logging", module: "commons-logging"
    }

    compile 'org.springframework:spring-webmvc:4.2.4.RELEASE'
    compile 'org.springframework:spring-test:4.2.4.RELEASE'