10 Running JUnit tests from Maven 3
This chapter covers
- Introducing Maven
- Managing dependenciesthe Maven way
- Creating a Maven project from the scratch
- Testing the Maven project with JUnit 5
- Introducing Maven plugins
- Using the Maven Surefire Plugins
The conventional view serves to protect us from the painful job of thinking.
-John Kenneth Galbraith
In this chapter we will discuss about a very common build system tool called Maven. For the previous chapters, as you have been provided Maven projects, you needed only to look at some external dependencies, to run some very simple commands, or to run the tests from inside the IDE. We will now make a brief introduction to this build system, which will be very useful if you need a systematic way to start your tests.
Maven addresses two aspects of building software: first, it describes how software is built, and then, it describes the needed dependencies. Unlike earlier tools like Apache Ant, it uses conventions for the build procedure, and only exceptions need to be written down. It relies on an XML file to describe its full configuration, most importantly here the meta-information about the software project being built, the needed dependencies on other external components, and the required plug-ins.