11 Running JUnit tests from Gradle 5
This chapter covers
- Introducing Gradle
- Installing Gradle
- Creating Gradle tasks
- Setting up a Gradle project
- Using Gradle plugins
- Creating a Gradle project from the scratch and testing it with JUnit 5
- Comparing Gradle and Maven
Mixing one’s wines may be a mistake, but old and new wisdom mix admirably.
-Bertold Brecht
In this chapter, we will analyze the last comer to the world of build system tools. Gradle is an open-source build automation system that started from the concepts of Apache Ant and Apache Maven. Instead of the XML form that Apache Maven is using, as you have seen into chapter 10, Gradle introduces a DSL (domain-specific language) based on Groovy for declaring the project configuration.
A domain-specific language is a computer language dedicated to address a specfic application domain. The idea is to have languages whose purpose is to solve problems belonging to a specific domain. In case of builds, one of the results of applying the DSL idea is Gradle.
Groovy is a Java-syntax-compatible object-oriented programming language that runs on the JVM (Java Virtual Machine).
11.1 Introducing Gradle
We'll take a look at various aspects of using Gradle to manage building and testing Java applications, with focus on the testing.