Working with Java multi-project builds

In a Java project, we usually have compile or runtime dependencies between projects. For example, the output of one project is a compile dependency for another project. This is very common in Java projects. Let's create a Java project with a common project that contains a Java class used by other projects. We will add a services project that references the class in the common project. Finally, we will add a web project with a Java servlet class that uses classes from the services project.

We have the following directory structure for our project:

. ├── build.gradle ├── common │ └── src │ └── main │ └── java │ └── sample │ └── gradle │ └── util │ └── Logger.java ├── services │ └── sample │ └── src │ ├── main ...

Get Gradle Effective Implementations Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.