gradle-lint-plugin icon indicating copy to clipboard operation
gradle-lint-plugin copied to clipboard

Dependency fixes may affect wrong dependencies block

Open DanielThomas opened this issue 9 years ago • 0 comments

Have a build script that has dependencies from an apply from and buildscript dependencies, and the fixes for unused-dependencies are appended to the dependencies block within buildscript:

buildscript {
    repositories {
        jcenter()
        maven { url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' }
    }
    dependencies {
        classpath 'io.spring.gradle:dependency-management-plugin:0.6.0.RELEASE'
        classpath 'com.netflix.nebula:nebula-kotlin-plugin:1.1.0-M01-5'
    }
}

apply plugin: 'nebula.dependency-lock'
apply plugin: 'nebula.integtest'
apply plugin: 'nebula.kotlin'
apply plugin: 'nebula.nebula-release'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'war'

apply from: 'gradle/dependencies.gradle'
apply from: 'gradle/lint.gradle'
apply from: 'gradle/package.gradle'
apply from: 'gradle/test.gradle'

After:

buildscript {
    repositories {
        jcenter()
        maven { url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' }
    }
    dependencies {
       compile 'org.apache.httpcomponents:httpclient:4.5'
       compile 'com.fasterxml.jackson.core:jackson-annotations:2.8.1'
       compile 'org.apache.kafka:kafka-clients:0.9.0.1'
       compile 'org.springframework:spring-web:4.3.2.RELEASE'
       compile 'org.springframework.boot:spring-boot:1.4.0.RELEASE'
       compile 'com.fasterxml.jackson.core:jackson-databind:2.8.1'
       compile 'com.netflix.spectator:spectator-api:0.40.0'
       compile 'org.springframework:spring-context:4.3.2.RELEASE'
       compile 'com.amazonaws:aws-java-sdk-s3:1.11.6'
       compile 'org.springframework:spring-beans:4.3.2.RELEASE'
       compile 'com.fasterxml.jackson.core:jackson-core:2.8.1'
       compile 'org.apache.tomcat.embed:tomcat-embed-core:8.5.4'
       compile 'javax.inject:javax.inject:1'
       compile 'com.amazonaws:aws-java-sdk-core:1.11.6'
       compile 'org.jetbrains.kotlin:kotlin-runtime:1.1-M01'
       compile 'com.netflix.feign:feign-core:8.16.2'
       compile 'com.netflix.feign:feign-slf4j:8.16.2'
       compile 'org.apache.httpcomponents:httpcore:4.4.1'
       compile 'org.springframework.cloud:spring-cloud-netflix-eureka-client:1.1.5.RELEASE'
       compile 'org.springframework.cloud:spring-cloud-aws-messaging:1.1.0.RELEASE'
       compile 'org.jetbrains.kotlin:kotlin-stdlib:1.1-M01'
       compile 'org.springframework:spring-core:4.3.2.RELEASE'
       compile 'org.springframework:spring-webmvc:4.3.2.RELEASE'
       compile 'org.springframework.boot:spring-boot-autoconfigure:1.4.0.RELEASE'
        classpath 'io.spring.gradle:dependency-management-plugin:0.6.0.RELEASE'
        classpath 'com.netflix.nebula:nebula-kotlin-plugin:1.1.0-M01-5'
    }
}

Of course, it'd also be awesome if lint considered apply from files too. And if these were ordered :)

DanielThomas avatar Aug 20 '16 00:08 DanielThomas