Working with Java multi-project builds
In a Java project, we usually have compile or runtime dependencies between projects. The output of one project is a compile dependency for another project, for example. 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:
root/ build.gradle settings.gradle common/ src/main/java/sample/gradle/util/ Logger.java services/sample src/main/java/sample/gradle/ api/ SampleService.java impl/ SampleImpl.java src/test/java/sample/gradle/impl/ SampleTest.java web/ src/main/java/sample/gradle/web/ SampleServlet.java src/main/webapp/WEB-INF/ web.xml...