91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

springboot聚合工程是什么意思

發布時間:2021-11-03 15:09:08 來源:億速云 閱讀:134 作者:小新 欄目:開發技術

小編給大家分享一下springboot聚合工程是什么意思,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!

    1.什么是聚合工程

    如下圖所示,擁有父子包結構的springboot工程叫做聚合工程。其中父包包括了多個子包(多個項目)。

    springboot聚合工程是什么意思

    2.聚合工程優勢

    1. 組件化管理通用功能,動態的添加功能。

    2. 統一管理jar包的版本號

    3. 提高復用性

    3.創建聚合工程

    1.首先創建一個springboot項目,然后刪除src文件夾 。

    2.創建子工程

    springboot聚合工程是什么意思

    選擇spring boot項目,然后繼續,創建項目。如果是工具,配置,組件化的項目(不需要啟動)可以繼續刪除啟動類和resources文件夾。

    springboot聚合工程是什么意思

    3. 修改父工程和子工程pom文件。然后聚合工程就搭建好了,這里最重點是pom文件的配置和標簽,下文就開始介紹。

    4.父工程詳解

    ps:這里以若依開源項目為例,結構如下,我們主要講解紅框里面的配置,父工程為RuoYi-Cloud,包括ruoyi-auth,ruoyi-gateway,ruoyi-visual,ruoyi-api,ruoyi-common子項目。而ruoyi-modules子工程也包括多個子工程。

    springboot聚合工程是什么意思

    1.pom文件

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
    
        <groupId>com.ruoyi</groupId>
        <artifactId>ruoyi</artifactId>
        <version>2.5.0</version>
    
        <name>ruoyi</name>
        <url>http://www.ruoyi.vip</url>
        <description>若依微服務系統</description>
    
        <properties>
            <ruoyi.version>2.5.0</ruoyi.version>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
            <java.version>1.8</java.version>
            <spring-boot.version>2.3.7.RELEASE</spring-boot.version>
            <spring-cloud.version>Hoxton.SR9</spring-cloud.version>
            <spring-cloud-alibaba.version>2.2.5.RELEASE</spring-cloud-alibaba.version>
    		<spring-boot-admin.version>2.3.1</spring-boot-admin.version>
            <spring-boot.mybatis>2.1.4</spring-boot.mybatis>
            <swagger.fox.version>2.9.2</swagger.fox.version>
            <swagger.core.version>1.5.24</swagger.core.version>
            <tobato.version>1.26.5</tobato.version>
            <kaptcha.version>2.3.2</kaptcha.version>
            <pagehelper.boot.version>1.3.0</pagehelper.boot.version>
            <druid.version>1.2.4</druid.version>
            <dynamic-ds.version>3.2.1</dynamic-ds.version>
            <commons.io.version>2.5</commons.io.version>
            <commons.fileupload.version>1.3.3</commons.fileupload.version>
            <velocity.version>1.7</velocity.version>
            <fastjson.version>1.2.75</fastjson.version>
            <minio.version>8.0.3</minio.version>
    		<poi.version>4.1.2</poi.version>
            <common-pool.version>2.6.2</common-pool.version>
        </properties>
    
        <!-- 依賴聲明 -->
        <dependencyManagement>
            <dependencies>
    
                <!-- SpringCloud 微服務 -->
                <dependency>
                    <groupId>org.springframework.cloud</groupId>
                    <artifactId>spring-cloud-dependencies</artifactId>
                    <version>${spring-cloud.version}</version>
                    <type>pom</type>
                    <scope>import</scope>
                </dependency>
    
    			<!-- SpringCloud Alibaba 微服務 -->
                <dependency>
                    <groupId>com.alibaba.cloud</groupId>
                    <artifactId>spring-cloud-alibaba-dependencies</artifactId>
                    <version>${spring-cloud-alibaba.version}</version>
                    <type>pom</type>
                    <scope>import</scope>
                </dependency>
    
                <!-- SpringBoot 依賴配置 -->
                <dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-dependencies</artifactId>
                    <version>${spring-boot.version}</version>
                    <type>pom</type>
                    <scope>import</scope>
                </dependency>
    			
                <!--  SpringBoot 監控客戶端 -->
                <dependency>
                    <groupId>de.codecentric</groupId>
                    <artifactId>spring-boot-admin-starter-client</artifactId>
                    <version>${spring-boot-admin.version}</version>
                </dependency>
    			
                <!-- FastDFS 分布式文件系統 -->
                <dependency>
                    <groupId>com.github.tobato</groupId>
                    <artifactId>fastdfs-client</artifactId>
                    <version>${tobato.version}</version>
                </dependency>
    			
                <!-- Mybatis 依賴配置 -->
                <dependency>
                    <groupId>org.mybatis.spring.boot</groupId>
                    <artifactId>mybatis-spring-boot-starter</artifactId>
                    <version>${spring-boot.mybatis}</version>
                </dependency>
    			
                <!-- Swagger 依賴配置 -->
                <dependency>
                    <groupId>io.swagger</groupId>
                    <artifactId>swagger-models</artifactId>
                    <version>${swagger.core.version}</version>
                </dependency>
                <dependency>
                    <groupId>io.swagger</groupId>
                    <artifactId>swagger-annotations</artifactId>
                    <version>${swagger.core.version}</version>
                </dependency>
    
                <!-- 驗證碼 -->
                <dependency>
                    <groupId>com.github.penggle</groupId>
                    <artifactId>kaptcha</artifactId>
                    <version>${kaptcha.version}</version>
                </dependency>
    
                <!-- pagehelper 分頁插件 -->
                <dependency>
                    <groupId>com.github.pagehelper</groupId>
                    <artifactId>pagehelper-spring-boot-starter</artifactId>
                    <version>${pagehelper.boot.version}</version>
                </dependency>
    
                <!-- io常用工具類 -->
                <dependency>
                    <groupId>commons-io</groupId>
                    <artifactId>commons-io</artifactId>
                    <version>${commons.io.version}</version>
                </dependency>
    
                <!-- excel工具 -->
                <dependency>
                    <groupId>org.apache.poi</groupId>
                    <artifactId>poi-ooxml</artifactId>
                    <version>${poi.version}</version>
                </dependency>
    
                <!-- 文件上傳工具類 -->
                <dependency>
                    <groupId>commons-fileupload</groupId>
                    <artifactId>commons-fileupload</artifactId>
                    <version>${commons.fileupload.version}</version>
                </dependency>
    
                <!-- 代碼生成使用模板 -->
                <dependency>
                    <groupId>org.apache.velocity</groupId>
                    <artifactId>velocity</artifactId>
                    <version>${velocity.version}</version>
                    <exclusions>
                        <exclusion>
                            <groupId>commons-collections</groupId>
                            <artifactId>commons-collections</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
    
                <!-- JSON 解析器和生成器 -->
                <dependency>
                    <groupId>com.alibaba</groupId>
                    <artifactId>fastjson</artifactId>
                    <version>${fastjson.version}</version>
                </dependency>
                
                <!-- 公共資源池 -->
                <dependency>
                    <groupId>org.apache.commons</groupId>
                    <artifactId>commons-pool2</artifactId>
                    <version>${common-pool.version}</version>
                </dependency>
    
                <!-- 核心模塊 -->
    	        <dependency>
                    <groupId>com.ruoyi</groupId>
                    <artifactId>ruoyi-common-core</artifactId>
                    <version>${ruoyi.version}</version>
                </dependency>
    			
                <!-- 接口模塊 -->
                <dependency>
                    <groupId>com.ruoyi</groupId>
                    <artifactId>ruoyi-common-swagger</artifactId>
                    <version>${ruoyi.version}</version>
                </dependency>
    	        
                <!-- 安全模塊 -->
                <dependency>
                    <groupId>com.ruoyi</groupId>
                    <artifactId>ruoyi-common-security</artifactId>
                    <version>${ruoyi.version}</version>
                </dependency>
    	        
                <!-- 權限范圍 -->
                <dependency>
                    <groupId>com.ruoyi</groupId>
                    <artifactId>ruoyi-common-datascope</artifactId>
                    <version>${ruoyi.version}</version>
                </dependency>
                
                <!-- 多數據源 -->
                <dependency>
                    <groupId>com.ruoyi</groupId>
                    <artifactId>ruoyi-common-datasource</artifactId>
                    <version>${ruoyi.version}</version>
                </dependency>
    			
                <!-- 日志記錄 -->
                <dependency>
                    <groupId>com.ruoyi</groupId>
                    <artifactId>ruoyi-common-log</artifactId>
                    <version>${ruoyi.version}</version>
                </dependency>
    			
                <!-- 緩存服務 -->
                <dependency>
                    <groupId>com.ruoyi</groupId>
                    <artifactId>ruoyi-common-redis</artifactId>
                    <version>${ruoyi.version}</version>
                </dependency>
    			
                <!-- 系統接口 -->
                <dependency>
                    <groupId>com.ruoyi</groupId>
                    <artifactId>ruoyi-api-system</artifactId>
                    <version>${ruoyi.version}</version>
                </dependency>
    			
            </dependencies>
        </dependencyManagement>
    
        <modules>
    		<module>ruoyi-auth</module>
    		<module>ruoyi-gateway</module>
    		<module>ruoyi-visual</module>
    		<module>ruoyi-modules</module>
    		<module>ruoyi-api</module>
    		<module>ruoyi-common</module>
        </modules>
        <packaging>pom</packaging>
    
        <dependencies>
            <!-- swagger -->
            <dependency>
                <groupId>io.swagger</groupId>
                <artifactId>swagger-annotations</artifactId>
                <version>1.5.10</version>
            </dependency>
        </dependencies>
    
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>${java.version}</source>
                        <target>${java.version}</target>
                        <encoding>${project.build.sourceEncoding}</encoding>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    
    </project>
    <name><url><description>都是非必須,字面意思。
    <groupId>:域 例如com
    <artifactId>:公司名  groupid和artifactId被統稱為“坐標”是為了保證項目唯一性而提出的
    <version>:項目的版本號
    <properties>:屬性的占位符 如java中的常量 
    
    <dependencyManagement>:在我們項目頂層的POM文件中,我們會看到dependencyManagement元素。通過它元素來管理jar包的版本,讓子項目中引用一個依賴而不用顯示的列出版本號。Maven會沿著父子層次向上走,直到找到一個擁有dependencyManagement元素的項目,然后它就會使用在這個dependencyManagement元素中指定的版本號。
    
    <dependencies>:指定所有的子工程都下載該包。

    白話說 如果父工程有,且groupId和artifactId相同,那么子工程不需要指定版本號, 直接使用父工程版本號。

    例如:當子工程有groupId為org.springframework.cloud時,引用當前父工程指定版本。子工程不用在寫版本號了。

    <!-- SpringCloud 微服務 -->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>${spring-cloud.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>

    <modules>:指當前父工程包含的子工程 如果這里不引入 那么 刷新父工程pom時 子工程不會下載jar包
    <build>:打包配置
    <packaging>pom</packaging>在聚合工程中 一定要配置 指的是在引入其他工程時 直接引入代碼,否則就會打成jar包 這樣就會報錯了

    5.ruoyi-modules子工程配置

    這里我們選擇一個最有代表性的子工程ruoyi-modules來介紹。

    1.pom文件

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <parent>
            <groupId>com.ruoyi</groupId>
            <artifactId>ruoyi</artifactId>
            <version>2.5.0</version>
        </parent>
        <modelVersion>4.0.0</modelVersion>
    
        <modules>
            <module>ruoyi-system</module>
            <module>ruoyi-gen</module>
            <module>ruoyi-job</module>
            <module>ruoyi-file</module>
        </modules>
    
        <artifactId>ruoyi-modules</artifactId>
        <packaging>pom</packaging>
    
        <description>
            ruoyi-modules業務模塊
        </description>
    
    </project>

    這里主要配置是

    <parent>:內容就是父工程的<groupId><artifactId><version>
    <modules>:指該工程包含ruoyi-system,ruoyi-gen,ruoyi-job,ruoyi-file子工程

    2.ruoyi-system子項目配置

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns="http://maven.apache.org/POM/4.0.0"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <parent>
            <groupId>com.ruoyi</groupId>
            <artifactId>ruoyi-modules</artifactId>
            <version>2.5.0</version>
        </parent>
        <modelVersion>4.0.0</modelVersion>
    	
        <artifactId>ruoyi-modules-system</artifactId>
    
        <description>
            ruoyi-modules-system系統模塊
        </description>
    	
        <dependencies>
        	
        	<!-- SpringCloud Alibaba Nacos -->
            <dependency>
                <groupId>com.alibaba.cloud</groupId>
                <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
            </dependency>
            
            <!-- SpringCloud Alibaba Nacos Config -->
            <dependency>
                <groupId>com.alibaba.cloud</groupId>
                <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
            </dependency>
            
        	<!-- SpringCloud Alibaba Sentinel -->
            <dependency>
                <groupId>com.alibaba.cloud</groupId>
                <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
            </dependency>
            
        	<!-- SpringBoot Actuator -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-actuator</artifactId>
            </dependency>
    		
            <!-- Swagger UI -->
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger-ui</artifactId>
                <version>${swagger.fox.version}</version>
            </dependency>
    		
            <!-- Mysql Connector -->
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
            </dependency>
            
            <!-- RuoYi Common DataSource -->
            <dependency>
                <groupId>com.ruoyi</groupId>
                <artifactId>ruoyi-common-datasource</artifactId>
            </dependency>
            
            <!-- RuoYi Common DataScope -->
            <dependency>
                <groupId>com.ruoyi</groupId>
                <artifactId>ruoyi-common-datascope</artifactId>
            </dependency>
            
            <!-- RuoYi Common Log -->
            <dependency>
                <groupId>com.ruoyi</groupId>
                <artifactId>ruoyi-common-log</artifactId>
            </dependency>
            
            <!-- RuoYi Common Swagger -->
            <dependency>
                <groupId>com.ruoyi</groupId>
                <artifactId>ruoyi-common-swagger</artifactId>
            </dependency>
    
        </dependencies>
    
        <build>
            <finalName>${project.artifactId}</finalName>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <executions>
                        <execution>
                            <goals>
                                <goal>repackage</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
       
    </project>

    <parent>:配置父工程ruoyi-modules的<groupId><artifactId><version>
    <dependencies>:本項目的依賴

    如果想引入其他工程,只需要加入:

    <!-- RuoYi Common DataScope -->
            <dependency>
                <groupId>com.ruoyi</groupId>
                <artifactId>ruoyi-common-datascope</artifactId>
            </dependency>
            
            <!-- RuoYi Common Log -->
            <dependency>
                <groupId>com.ruoyi</groupId>
                <artifactId>ruoyi-common-log</artifactId>
            </dependency>
            
            <!-- RuoYi Common Swagger -->
            <dependency>
                <groupId>com.ruoyi</groupId>
                <artifactId>ruoyi-common-swagger</artifactId>
            </dependency>

    以上是“springboot聚合工程是什么意思”這篇文章的所有內容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內容對大家有所幫助,如果還想學習更多知識,歡迎關注億速云行業資訊頻道!

    向AI問一下細節

    免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

    AI

    彭水| 祁连县| 临武县| 紫阳县| 清丰县| 浮梁县| 安图县| 印江| 北碚区| 方正县| 吴川市| 呼和浩特市| 洛南县| 青田县| 富平县| 台北县| 建宁县| 广州市| 迁安市| 临漳县| 当涂县| 大石桥市| 珠海市| 内乡县| 台前县| 济源市| 聂拉木县| 中卫市| 沙雅县| 邯郸市| 西乌珠穆沁旗| 永川市| 偏关县| 桃园市| 玉门市| 佳木斯市| 韩城市| 呼和浩特市| 府谷县| 金门县| 甘谷县|