Maven project sub-module development explanation and entry case

1. Significance of sub-module development

A module only does its own corresponding functions, improving development efficiency, splitting a project into several sub-modules to facilitate mutual calls, sharing interfaces, reducing coupling and improving code reuse.
insert image description here

2. Introductory case of sub-module development

Next, split the domain module from the current module.
insert image description here
Create a new maven project module
insert image description here
, name parentId name groupId artifactId and other information ,
insert image description here
import the coordinates in module 03 into the internal
insert image description here
maven project of module 02. If the maven project wants to run, it executes the life cycle operations in maven. It should be noted that to check whether the dependency is successful, you only need to run the compile command in the maven life cycle to check. After importing the coordinates of the 03 module into the 02 module, you need to execute the install command within the life cycle of the 03 module to download the module to the maven local warehouse, so that the 02 module can truly rely successfully, otherwise an error will be reported because the 03 module cannot be found.

insert image description here

3. Summary

The first step is to create a maven module.
insert image description here
The second step is to write the module code
insert image description here
. The third step is to install the module to the local warehouse through the maven command (install command)
insert image description here

Guess you like

Origin blog.csdn.net/weixin_44860226/article/details/131586928