bookmark_borderGradle with Building Java Applications

Introduction

Gradle is a build automation tool for multi-language software development. It controls the development process in the tasks of compilation and packaging to testing, deployment, and publishing. Supported languages include Java, C/C++, and JavaScript.

Verify Java version

$ java -version
# openjdk version "11.0.8" 2020-07-14
# OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.8+10)
# OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.8+10, mixed mode)

Install Gradle on Mac

https://gradle.org/install/#prerequisites

$ brew install gradle
$ gradle -v

Welcome to Gradle 6.8.3!

Create Project Folder

$ mkdir anote
$ cd anote
$ gradle init

Run Application

$ ./gradlew run

Bundle the application

The application plugin also bundles the application, with all its dependencies, for you. The archive will also contain a script to start the application with a single command.

$ ./gradlew build

Publish a Build Scan

The best way to learn more about what your build is doing behind the scenes is to publish a build scan. To do so, just run Gradle with the --scan flag.

$ ./gradlew test

OR

$ gradle build
ANOTE.DEV