This chapter covers
- Why build tools matter for a well-grounded developer
- Maven
- Gradle
The JDK ships with a compiler to turn Java source code into class files as we saw in Chapter 4. Despite that fact, few projects of any size rely just on javac. Build tools are the norm for a number of reasons:
- Automating tedious operations
- Managing dependencies
- Ensuring consistency between developers
Although many options exist, two choices dominate the landscape today: Maven and Gradle. Understanding what these tools aim to solve, digging below the surface of how they get their job done, and understanding the differences between them - and how to extend them - will pay off for the well-grounded developer.
javac can turn any Java source file into a class file, but there’s more to building a typical Java project than that. Just getting all the files properly listed to the compiler could be tedious in a large project if done by hand. Build tools provide defaults for finding code and let you easily configure if you have a non-standard layout instead.
The default layout popularized by Maven and used by Gradle as well looks like this: