Quantcast
Channel: Gradle Forums - Latest posts
Viewing all articles
Browse latest Browse all 20394

How can I delete a file from inside a task?

$
0
0

project.Delete() cannot be called from outside a task or a buildScript. It also requires a path to your File or Dir

Right, so why doesn’t it work when I do this inside a custom task inside my build.gradle.kts

open class WindowsInstaller () : DefaultTask() {

...

@TaskAction
fun generateWindowsInstaller() {

    project.delete(
        fileTree("${project.buildDir}/jpackageAppImage")
    )

    ...
}
...

}

Unless I am misunderstanding something, according to the docs it should work.


Viewing all articles
Browse latest Browse all 20394