Spring Boot 支持多模块项目的打包,可以使用 Maven 或 Gradle 构建工具来实现。下面是使用 Maven 打包多模块项目的步骤:
<modules>
<module>module1</module>
<module>module2</module>
...
</modules>
<parent>
<groupId>com.example</groupId>
<artifactId>parent</artifactId>
<version>1.0</version>
</parent>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<build>
<finalName>module1</finalName>
</build>
mvn clean package
打包完成后,可以在各个子模块的 target 目录下找到生成的可执行 JAR 文件。
辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读: springboot自动装配方式有哪些