I am writing a custom Gradle plugin and trying to figure out how can I call a doLast() function inside my Gradle plugin then supplying some logic in there, but unfortunately with not much success.
This is syntax error at it.delete( Unresolved reference: delete:
project.tasks.create("cleanMendix", Delete::class.java) {task ->
task.doLast{
it.delete(
"${project.projectDir}/target",
"${project.projectDir}/.mendix-cache",
"${project.projectDir}/userlib",
"${project.projectDir}/deployment"
)
}
}.apply {
group = "mendix"
}
This is not deleting the files:
project.tasks.create("cleanMendix", Delete::class.java) {task ->
task.doLast{
task.delete(
"${project.projectDir}/target",
"${project.projectDir}/.mendix-cache",
"${project.projectDir}/userlib",
"${project.projectDir}/deployment"
)
}
}.apply {
group = "mendix"
}
If I call without doLast() it's working but it is also run in the configuration phase.