Writing sample build script(Hello World)

Gradle is based on the concept of task and you write these task in a file called build.gradle.

Below is a sample build.gradle file which has a task called helloWorld which prints the text ‘Hello world.’ on console.

Now to execute this build script we need to go to the directory where the build.gradle file is store and execute the below command command

gradle <task_name>

Now since our task name is helloWorldin the build.gradle file we will execute it with the command gradle helloWorld (-q for quitely) and below is the output of the command

Leave a Reply

Your email address will not be published. Required fields are marked *