What is build.gradle file?
You run a Gradle build using the gradle command. The gradle command looks for a file called build.gradle
in the current directory. You can call this build.gradle file a build script, although strictly speaking it is a
build configuration script. The build script defines a project and its tasks.
To try this out, create the following build script named build.gradle.
task hello {
doLast {
println 'Hello Java2Novice...'
}
}
|
Move to the folder where build.gradle file placed and run command "gradle hello"
java2novice$ gradle hello
:hello
Hello Java2Novice...
BUILD SUCCESSFUL
Total time: 3.348 secs
|
This build script defines a single task, called
hello, and adds an action to it. When you run gradle hello,
Gradle executes the hello task, which in turn executes the action
you've provided.
Reference: Gradle Documentation
|