How to create a multi module project in Java?

How to create a multi module project in Java?

In a the library directory, create the following subdirectory structure (for example, by using mkdir -p src/main/java/com/example/multimodule/service on *nix systems): Now you need to configure a build tool (Maven or Gradle).

How to create a multi module project from scratch?

To start from scratch, move on to Create a Root Project. To skip the basics, do the following: Download and unzip the source repository for this guide, or clone it using Git: git clone https://github.com/spring-guides/gs-multi-module.git

What does a multi module Maven project do?

A multi-module Maven project is one that manages a group of submodules and is built from a parent POM. The submodules are normal Maven projects, and they can be built independently or from the parent POM.

How to create a multi module project in spring?

In a the library directory, create the following subdirectory structure (for example, by using mkdir -p src/main/java/com/example/multimodule/service on *nix systems): Now you need to configure a build tool (Maven or Gradle). In both cases, note that the Spring Boot plugin is not used in the library project at all.

Can a multi-module project with Maven be maintained?

In that case, without a specialized build tool, we’ll have to build both components separately or write a script which would compile the code, run tests and show the results. Then, after we get even more modules in the project, it will become harder to manage and maintain.

How are subprodules related to parent pom in Maven?

Submodules or subprojects are regular Maven projects that inherit from parent POM. As we already know, inheritance let us share the configuration and dependencies with submodules. However, if we’d like to build or release our project in one shot, we have to declare our submodules explicitly in parent POM.