In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you what the meaning of springboot aggregation project, I believe that most people do not know much, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to understand it!
1. What is aggregation engineering?
As shown in the following figure, a springboot project with a parent-child package structure is called an aggregation project. The parent package includes multiple child packages (multiple projects).
two。 Advantages of aggregation engineering
Component-based management of general functions, dynamic add functions.
Uniformly manage the version number of the jar package
Improve reusability
3. Create an aggregation project
1. First create a springboot project, and then delete the src folder.
two。 Create a subproject
Select the spring boot project, and then continue to create the project. If it is a tool, configuration, componentized project (does not need to start) can continue to delete startup classes and resources folders.
3. Modify the parent and child project pom files. Then the aggregation project is built, and the most important point here is the configuration and tags of the pom file, which will be introduced below.
4. Detailed explanation of parent project
Ps: take the open source project as an example. The structure is as follows. We mainly explain the configuration in the red box. The parent project is RuoYi-Cloud, including the ruoyi-auth,ruoyi-gateway,ruoyi-visual,ruoyi-api,ruoyi-common sub-project. The ruoyi- modules sub-project also includes several sub-projects.
1.pom file
4.0.0 com.ruoyi ruoyi 2.5.0 ruoyi http://www.ruoyi.vip according to the micro service system 2.5.0 UTF-8 UTF-8 1.8 2.3.7.RELEASE Hoxton.SR9 2.2.5.RELEASE 2.3.1 2.1.4 2.9. 2 1.5.24 1.26.5 2.3.2 1.3.0 1.2.4 3.2.1 2.5 1.3.3 1.7 1.2.75 8.0.3 4.1.2 2.6.2 Org.springframework.cloud spring-cloud-dependencies ${spring-cloud.version} pom import com.alibaba.cloud spring-cloud-alibaba-dependencies ${spring-cloud-alibaba.version} pom import org.springframework.boot spring-boot-dependencies ${spring-boot.version} pom import De.codecentric spring-boot-admin-starter-client ${spring-boot-admin.version} com.github.tobato fastdfs-client ${tobato.version} Org.mybatis.spring.boot mybatis-spring-boot-starter ${spring-boot.mybatis} io.swagger Swagger-models ${swagger.core.version} io.swagger swagger-annotations ${swagger.core.version} com.github.penggle kaptcha ${kaptcha.version} Com.github.pagehelper pagehelper-spring-boot-starter ${pagehelper.boot.version} commons-io commons-io ${commons.io.version} Org.apache.poi poi-ooxml ${poi.version} commons-fileupload commons-fileupload ${commons.fileupload.version} Org.apache.velocity velocity ${velocity.version} commons-collections commons-collections Com.alibaba fastjson ${fastjson.version} org.apache.commons commons-pool2 ${common-pool.version} com. Ruoyi ruoyi-common-core ${ruoyi.version} com.ruoyi ruoyi-common-swagger ${ruoyi.version} Com.ruoyi ruoyi-common-security ${ruoyi.version} com.ruoyi ruoyi-common-datascope ${ruoyi.version} Com.ruoyi ruoyi-common-datasource ${ruoyi.version} com.ruoyi ruoyi-common-log ${ruoyi.version} Com.ruoyi ruoyi-common-redis ${ruoyi.version} com.ruoyi ruoyi-api-system ${ruoyi.version} Ruoyi-auth ruoyi-gateway ruoyi-visual ruoyi-modules ruoyi-api ruoyi-common pom io.swagger swagger-annotations 1.5. 10 org.apache.maven.plugins maven-compiler-plugin ${java.version} ${java.version} ${project.build.sourceEncoding} are optional Literally. Domains such as com: company names groupid and artifactId are collectively referred to as "coordinates" to ensure the uniqueness of the project: the version number of the project: placeholders for attributes such as the constant in java: in the POM file at the top level of our project, we will see the dependencyManagement element. Manage the version of the jar package through its element, allowing the subproject to refer to a dependent column that does not need to be displayed. Maven moves up the parent-child level until it finds a project with a dependencyManagement element, and then it uses the version number specified in the dependencyManagement element. Specifies that all subprojects download the package
In vernacular, if the parent project has the same groupId and artifactId, then the child project does not need to specify the version number, but directly uses the parent project version number.
For example, when a child project has a groupId of org.springframework.cloud, the specified version of the current parent project is referenced. There is no need to write the version number for the sub-project.
Org.springframework.cloud spring-cloud-dependencies ${spring-cloud.version} pom import
Refers to the child project contained in the current parent project if it is not introduced here, then the child project will not download the jar package when refreshing the parent project pom
Packaged configuration
Pom must be configured in the aggregation project, which means that the code is directly introduced when other projects are introduced, otherwise it will be packed into a jar package and the error will be reported.
5. Ruoyi-modules subproject configuration
Here we choose one of the most representative sub-project ruoyi-modules to introduce.
1.pom file
Com.ruoyi ruoyi 2.5.0 4.0.0 ruoyi-system ruoyi-gen ruoyi-job ruoyi-file ruoyi-modules pom ruoyi-modules Service Module
The main configuration here is
The content is that of the parent project
Means that the project contains a ruoyi-system,ruoyi-gen,ruoyi-job,ruoyi- file sub-project
2.ruoyi-system subproject configuration
Com.ruoyi ruoyi-modules 2.5.0 4.0.0 ruoyi-modules-system ruoyi-modules-system system Module com.alibaba.cloud spring-cloud-starter-alibaba-nacos-discovery Com.alibaba.cloud spring-cloud-starter-alibaba-nacos-config com.alibaba.cloud spring-cloud-starter-alibaba-sentinel org.springframework.boot spring-boot-starter-actuator Io.springfox springfox-swagger-ui ${swagger.fox.version} mysql mysql-connector-java com.ruoyi ruoyi-common-datasource Com.ruoyi ruoyi-common-datascope com.ruoyi ruoyi-common-log com.ruoyi ruoyi-common-swagger ${project.artifactId} Org.springframework.boot spring-boot-maven-plugin repackage
Configure the parent project ruoyi-modules
Dependence of this project
If you want to introduce other projects, just add:
Com.ruoyi ruoyi-common-datascope com.ruoyi ruoyi-common-log com.ruoyi ruoyi-common-swagger above is all the content of this article "what is the meaning of springboot aggregation Project?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.