Inheritance and Aggregation in Maven Project Development

1. Aggregate Engineering Concepts

insert image description here
Set up an empty maven project with only pom files in the project, and set the packaging method of this project to pom.
insert image description here
Add the modules managed in the aggregation project to the aggregation project
insert image description here

2. Aggregation summary

insert image description here

3. Inheritance

insert image description here
For example, the 02 project below inherits the 01 project above. In the pom file of the 02 project, configure the dependency of the parent project to be inherited and add a relative path.
insert image description here
At this point, all the public dependent modules used in 2, 3, and 4 can be placed in the parent project module, which is easy to manage.
insert image description here
In addition to managing the common ones, you can also manage the dependencies used by some modules. For example, manage the Junit dependencies used separately in module 2. Provide corresponding dependencies in the parent project.
insert image description here
Add use in module 2. But do not write the version, it is convenient to manage the version in the parent project.
insert image description here

4. Inheritance summary

insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here

Guess you like

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