Using Gradle

Gradle is a build automation tool. It can automate build-related tasks such as

The gradle configuration for this project is defined in the build script build.gradle.

To learn more about gradle build scripts, refer Build Scripts Basics.

Running Gradle Commands

To run a Gradle command, open a command window on the project folder and enter the Gradle command. Gradle commands look like this:

If you do not specify any tasks, Gradlew will run the default tasks clean headless allTests coverage

Cleaning the Project

Creating the JAR file

Note: Why do we create a fat JAR? If we package only our own class files into the JAR file, it will not work properly unless the user has all the other JAR files (i.e. third party libraries) our classes depend on, which is rather inconvenient. Therefore, we package all dependencies into a single JAR files, creating what is also known as a fat JAR file. To create a fat JAR fil, we use the Gradle plugin shadow jar.

Running the application

Running code style checks

The set of code style rules implemented can be found in config/checkstyle/checkstyle.xml. To enable exceptions to code styles, add in the comment //CODESTYLE.OFF: RuleName at the start of the section and //CODESTYLE.ON: RuleName at the end of the section.

Running Tests

Here are some examples:

Updating Dependencies

There is no need to run these Gradle tasks manually as they are called automatically by other relevant Gradle tasks.