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

前端 未结 8 1643
被撕碎了的回忆
被撕碎了的回忆 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:34

    You should not try to override the default clean task, but instead configure it to delete additional stuff like

    clean {
        delete rootProject.buildDir
    }
    

    But check first whether this is not the default behavior of the clean task anyway.

    Alternatively if you want to be able to do a specific clean action individually, you can also define a separate task and add a dependency like

    task customClean(type: Delete) {
        delete rootProject.buildDir
    }
    clean.dependsOn customClean
    

提交回复
热议问题