![]() ![]() Besides that, we have to deal with the environment we are working with, which may consist of many projects, large or small, external projects, libraries, shared modules, utilities, and many others. ![]() When dealing with large-scale software, we have to communicate, work, and cooperate with a lot of people - whether in an organization or a community. So, with that in mind, let's get started. This article will not cover Maven basics. However, if you are not familiar with Maven, I highly recommend reading this article first and getting some experience using Maven. Properties are inherited from parent to child, so we need not mention Java version in any of our child poms.Īdd the dependency spring-boot-starter-web in the dependencies section.In this article, we are going to look at how to implement a multi-module project in Maven with versioning and dependency management, as well as the best practices for building big, large-scale projects from both a developer perspective and a DevOps/management perspective. Similarly, create other sub-modules like controller, domain, service, repository.Īt this point, your Project Explorer view would look like this:Įdit your parent pom, spring-boot-multi-module/pom.xml, to look like below.Īdd the properties section to set the Java version as 11. ![]() This view is better when working with multi-module projects. Select "Create a simple project (skip archetype selection)", input the Module name as "application", ensure that the selected "Parent Project" is the one created above and click on Finish.Īt this point, go to Windows in the top Toolbar in Eclipse and go to Show View -> Project Explorer. Right-click the parent project created above, "spring-boot-multi-module", New -> Other -> Maven Module and click on Next. Let's start with creating the sub-module "application". The repository is where your Repository implementations live.Service is where your Service implementations live.The domain is where your aggregate, entities, value-objects live along with Service and Repository Interfaces.This is also the module that houses all the DTOs that will be exposed to the outside world as JSON output from the REST end-points. The controller houses the controller classes that provide REST end-points or similar stuff.Child Module application is where your the Main class, will reside.Next, we are going to create 5 sub-modules namely application, controller, domain, service, repository. Artifact Id: spring-boot-starter-parent.Since it is a Spring Boot application that we are creating, we will include the following as Parent Project: As this is the parent module, its packaging has to be pom.įeel free to enter the Name and Description of your artifact. Input "spring-boot-multi-module" or something similar to Artifact Id.Ĭhange the packaging to pom. Input "" or something similar to Group Id. Select "Create a simple project (skip archetype selection)" and click on Next. ![]() Open Eclipse, go to File -> New -> Other -> Maven -> Maven Project and click on Next. So, without further ado, let's get going. By running the maven build on parent’s pom file all sub-modules will be built. We have the option of running Maven build on separate module’s pom file or the parent’s pom file. The sub-modules are regular maven projects that have packaging type different from pom, such as jar, war, ear. The parent pom is located in the project’s root directory and must have the packaging of type pom. With this in your arsenal you should be in a position to extend this as per your project needs.Ī multi-module project is built from a parent pom that manages a group of sub-modules. Here I must confess that I am not being a total DDD purist here adhering to all the concepts but instead just covering the first mile. In this post we will go through how to create a Multi-Module Maven Project with Spring Boot following Domain-Driven Methodology. ![]()
0 Comments
Leave a Reply. |