0% found this document useful (0 votes)
9 views

Gradle-Exercises

This document provides a step-by-step guide for creating a project using Gradle, including initializing a new project, locating the project folder, and viewing available default tasks. It also outlines the process for building a simple Java application that prints text, detailing folder structure and necessary commands. The instructions culminate in executing the built application to display the output from the Java code created.

Uploaded by

Claude Dex
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Gradle-Exercises

This document provides a step-by-step guide for creating a project using Gradle, including initializing a new project, locating the project folder, and viewing available default tasks. It also outlines the process for building a simple Java application that prints text, detailing folder structure and necessary commands. The instructions culminate in executing the built application to display the output from the Java code created.

Uploaded by

Claude Dex
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Creating a project with Gradle init

1. Open cmd
2. Make new directory titled “gradle-tutorial” by typing mkdir gradle-
tutorial

3. Change directory to gradle-tutorial by typing cd gradle-tutorial

4. Type gradle init to initialize a new project

5. Select basic by typing 1, then select groovy by typing 1 again


6. Ignore the next line and the project name by clicking enter

Locating the folder of the Project created

1. To locate the folder of the newly created project, you can use the
location indicated on the cmd we used earlier.

2. Go to the indicated location and open it to see the project folder and its
files
Viewing available default tasks using Gradle wrapper

1. Open cmd again and change directory to gradle-tutorial


2. Type gradlew tasks to view available default tasks
Building a Java Application that simply prints out a text

1. Create a new folder inside the gradle project folder


(src>main>java>com>bscs2a)

2. Create a text file and rename it GradleTutorial.java

3. Type the following codes inside the .java file

4. Edit build.gradle file located inside the project folder (inserting plugins)
and type the following:
5. Open cmd and change directory to gradle-tutorial, then type
gradlew tasks

6. Type gradlew build to create a build folder inside the project folder

7. Type java -jar build\libs\gradle-tutorial.jar, this will print out the


java code we made through a .java file

You might also like