Run ./gradlew
to set up gradle. You just have to have java installed.
gradle init
initialises a gradle setup. This requires gradle is installed.
You can list tasks with: ./gradlew tasks --all
Most editors have support for running tasks, and showing tasks.
like:
tasks.register("sayHelloWorld") {
doFirst {
logger.info("Hello world!")
}
}
Copying files can be done with the task:
./gradlew copyTaskSample
Here is a sample of a copy task:
tasks.register<Copy>("copyTaskSample") {
doFirst {
logger.info("copyTaskSample started!")
}
from("file.txt")
into("build")
doLast {
logger.info("Finished copying")
}
}
This is in build.gradle.kts, and you can see the task with ./gradlew tasks --all
.
Here is an example:
tasks.getByName("readJSONFile") { dependsOn("sleepTask") }
To read a json file see task:
./gradlew readJSONFile
-
run groovy scripts
-
run tasks in parallel