Declaring custom 'clean' task when using the standard Gradle lifecycle plugins is not allowed

前端 未结 8 1645
被撕碎了的回忆
被撕碎了的回忆 2020-12-06 09:02

I am adding a library to jCenter so to do that I needed to add some plugins to my project\'s build.gradle file. However, I am getting the error

Declar

8条回答
  •  伪装坚强ぢ
    2020-12-06 09:32

    In the given code:

    allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
    }
    
    tasks.withType(JavaCompile) {
        sourceCompatibility = "1.8"
        targetCompatibility = "1.8"
    }
    
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    }
    

    replace the task clean with task delete then it will work:

    allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
    }
    
    tasks.withType(JavaCompile) {
        sourceCompatibility = "1.8"
        targetCompatibility = "1.8"
    }
    
    
    task delete(type: Delete) {
        delete rootProject.buildDir`
    }
    }
    

提交回复
热议问题