Define Hello World Task (Gradle)
Defining a Task
tasks.register("hello") {
doLast {
println("Hello, Gradle!")
}
}
The doLast
block specifies the action to perform when the task is executed. In this case, it simply prints a message to the console.
# To run this task
mac> ./gradlew hello
Glass thought Sandbox Snapshot
Command to reproduce:
gt.sandbox.checkout.commit 192830c \
&& cd "${GT_SANDBOX_REPO}" \
&& cmd.run.announce "./gradlew hello"
Recorded output of command:
> Task :lib:hello
Hello, Gradle!
BUILD SUCCESSFUL in 394ms
1 actionable task: 1 executed
Backlinks