Juanma Leflet Estrada
05/03/2024, 9:56 AMtask hello {
doLast {
println "Hello world!"
}
}
but it's failing with the following error:
Could not find method task() for arguments [hello, test_36j2h73i78oarkgx47smjygs2$_run_closure1@6c6f8529] on build of type org.gradle.invocation.DefaultGradle.
What's going on? Won't Gradle 6.4.1 recognize closures?
Any help or clue would be most appreciated. Thanks!Thomas Broyer
05/03/2024, 10:07 AMbuild of type org.gradle.invocation.DefaultGradle
looks strange here. Wouldn't the message be about Project
in a build.gradle
file? Are you trying this in a settings.gradle
?
(disclaimer: I haven't used the Groovy DSL for years)Juanma Leflet Estrada
05/03/2024, 10:08 AMJuanma Leflet Estrada
05/03/2024, 10:11 AMThomas Broyer
05/03/2024, 10:19 AMSettings
)
You cannot create a task from there, the task()
method is only available on a `Project`: https://docs.gradle.org/6.4.1/dsl/org.gradle.api.Project.html#org.gradle.api.Project:task(java.lang.String,%20groovy.lang.Closure)Juanma Leflet Estrada
05/03/2024, 10:20 AMVampire
05/03/2024, 10:25 AMJuanma Leflet Estrada
05/03/2024, 10:27 AMVampire
05/03/2024, 10:34 AMallrojects { ... }
if you need the task on all projects of the build and so onJuanma Leflet Estrada
05/03/2024, 10:34 AMJuanma Leflet Estrada
05/03/2024, 10:35 AM