Springboot 多module打包方案示例詳解
Springboot 多module打包問題(依賴不存在)解決方案:
參考項目結(jié)構(gòu)如下:
說明: web模塊為最終的啟動模塊,web->service->manager->dao->entity+common
方案1(實際采用):
(1)在最外層父pom:
<build> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>false</filtering> </resource> <resource> <directory>src/main/resources</directory> <!-- 是否過濾資源文件,替換maven屬性 - 不過濾,否則過濾xlsx文件導致亂碼,XSSFWork讀取格式異常 --> <filtering>false</filtering> <includes> <include>**/*</include> <include>mapper/*.xml</include> </includes> </resource> </resources> </build>
(2)其他子模塊POM(非Springboot啟動類: common,entity,dao,manager,service):
無需指定<build/>
(3)Springboot啟動類子模塊POM(web):
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <mainClass>com.xxx.MxVehiclePartsApplication(此處替換為相應Springboot啟動類)</mainClass> </configuration> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin> </plugins> </build>
執(zhí)行mvn package后,可在啟動模塊(web)target下看到*.jar即為可執(zhí)行的jar包;
方案2:
(1)在最外層父pom:
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <mainClass>com.xxx.MxVehiclePartsApplication(此處替換為相應Springboot啟動類)</mainClass> </configuration> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin> </plugins> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>false</filtering> </resource> <resource> <directory>src/main/resources</directory> <!-- 是否過濾資源文件,替換maven屬性 - 不過濾,否則過濾xlsx文件導致亂碼,XSSFWork讀取格式異常 --> <filtering>false</filtering> <includes> <include>**/*</include> <include>mapper/*.xml</include> </includes> </resource> </resources> </build>
(2)其他子模塊POM(非Springboot啟動類: common,entity,dao,manager,service):
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <classifier>exec</classifier> </configuration> </plugin> </plugins> </build>
(3)Springboot啟動類子模塊POM(web):
無需指定<build/>
到此這篇關(guān)于Springboot 多module打包方案的文章就介紹到這了,更多相關(guān)Springboot module打包內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
- springBoot不同module之間互相依賴的實現(xiàn)
- IDEA創(chuàng)建SpringBoot父子Module項目的實現(xiàn)
- springboot創(chuàng)建多module項目的實例
- SpringBoot修改子模塊Module的jdk版本的方法 附修改原因
- idea創(chuàng)建包含多個springboot module的maven project的方法
- 淺談springboot多模塊(modules)開發(fā)
- 打包部署若依(RuoYi)SpringBoot后端和Vue前端圖文教程
- Springboot項目打包如何將依賴的jar包輸出到指定目錄
- SpringBoot-Maven打包壓縮瘦身方式
相關(guān)文章
Java實現(xiàn)彩色圖片轉(zhuǎn)換為灰度圖片的示例代碼
將彩色圖片轉(zhuǎn)換為灰度圖片是圖像處理中的常見操作,通常用于簡化圖像、增強對比度、或者進行后續(xù)的圖像分析,本項目的目標是通過Java實現(xiàn)將彩色圖片轉(zhuǎn)換為灰度圖片,需要的朋友可以參考下2025-02-02SpringBoot中使用攔截器攔截跳轉(zhuǎn)登錄的兩種實現(xiàn)方法
攔截器(Interceptor)是Spring框架提供的一種機制,用于在請求的生命周期中插入自定義邏輯,如身份驗證、日志記錄等,本文將詳細介紹兩種在SpringBoot中使用攔截器來控制用戶登錄并跳轉(zhuǎn)到指定頁面的方法,需要的朋友可以參考下2024-11-11spring cloud 阿波羅 apollo 本地開發(fā)環(huán)境搭建過程
Apollo(阿波羅)是攜程框架部門研發(fā)的配置管理平臺,能夠集中化管理應用不同環(huán)境、不同集群的配置,配置修改后能夠?qū)崟r推送到應用端,并且具備規(guī)范的權(quán)限、流程治理等特性2018-01-01springmvc+mybatis 做分頁sql 語句實例代碼
本文通過一段實例代碼給大家介紹了springmvc+mybatis 做分頁sql 語句的方法,代碼簡單易懂,非常不錯,具有參考借鑒價值,需要的朋友參考下吧2017-07-07