Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the project of creating multi-module maven aggregation by Idea

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article introduces how to create a multi-module maven aggregation project based on Idea. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.

1. How to understand the inheritance and aggregation of maven

Maven multi-module projects usually consist of a parent module and several sub-modules, each corresponding to a pom.xml. They are related to each other through inheritance and aggregation (also known as multi-modules). Multi-module is suitable for some large projects, through reasonable module splitting to achieve code reuse, easy to maintain and manage. Inheritance: similar to inheritance in java, it is the version declared by the parent pom.xml and the referenced jar, and child modules can be called directly without reference. Aggregation: the parent module contains multiple sub-modules is aggregation, which can be called between multiple sub-modules, but pay attention to the relationship and do not depend on each other. The advantage of this is that you can build with one command.

Note:

GroupId is the unique identifier of the project organization, which actually corresponds to the structure of the JAVA package. ArtifactId is the unique identifier of the project, and the name of the actual corresponding project is the name of the project root. GroupId is generally divided into multiple segments, the first paragraph is the domain, the second paragraph is the company name, and the third paragraph is usually the project name.

2.Idea creates a multi-module project

2.1Create parent module (empty maven project)

Pom.xml configuration 4.0.0 org.springframework.boot spring-boot-starter-parent 2.1.6.RELEASE cn.yskcoder.fire fire pom v1.0 fire-common fire-dao fire-service fire-web UTF-8 UTF-8 1.8 2.1.6.RELEASE

2.2. Create a tool class (common) module (dao, service are the same as this)

Pom.xml configuration 4.0.0 fire cn.yskcoder.fire v1.0 jar fire-common fire-common fire Universal tool Class Module

2.3. Create a database access (dao) module (pom.xml code only)

4.0.0 fire cn.yskcoder.fire v1.0 war fire-web fire-web fire web Module cn.yskcoder.fire fire-service v1.0 org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-aop org.springframework.boot spring-boot-starter-test test org.apache.maven.plugins maven-compiler-plugin 3.1 ${java.version} ${java.version} src/main/webapp false src/main/resources true

3.Idea packaged multi-module project

Clean package-Dmaven.test.skip=true

On how to create Idea to create multi-module maven aggregation project implementation is shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report