springboot maven-assembly-plugin使用
官网:Apache Maven Assembly Plugin – Introduction
**********************
maven assembly plugin
The Assembly Plugin for Maven enables developers to combine project output into a single distributable archive that also contains dependencies, modules, site documentation, and other files. # assembly插件可将project output、dependencies、模块、site文档等文件整合为一个文档
支持的文档格式
Currently it can create distributions in the following formats: zip、tar、jar、dir、war tar.gz (or tgz) tar.bz2 (or tbz2) tar.snappy tar.xz (or txz) and any other format that the ArchiveManager has been configured for
assembly descriptor format:描述归档文件的项目结构
**********************
示例
配置文件、依赖jar包外置,将配置文件、依赖jar包、项目jar包归档压缩
assembly.xml
assembly
tar.gz
zip
${project.build.directory}/config
config
${project.build.directory}/lib
lib
${project.build.directory}
.
${project.build.finalName}.jar
pom.xml
4.0.0 org.springframework.boot spring-boot-starter-parent2.5.5 com.example demo0.0.1-SNAPSHOT demo Demo project for Spring Boot 11 org.springframework.boot spring-boot-starter-weborg.springframework.boot spring-boot-configuration-processortrue org.projectlombok lomboktrue org.apache.maven.plugins maven-assembly-plugin3.3.0 org.springframework.boot spring-boot-starter-testtest hello org.springframework.boot spring-boot-maven-pluginorg.projectlombok lomboknothing nothingorg.apache.maven.plugins maven-jar-plugin3.2.0 true lib org.apache.maven.plugins maven-dependency-plugin3.2.0 copy package copy-dependencies jar jar ${project.build.directory}/lib org.apache.maven.plugins maven-assembly-plugin3.3.0 src/main/resources/assembly/assembly.xml assembly package single ${build.directory}/config src/main/resources *.properties *.yml
项目打包
解压hello-assembly.tar.gz:配置文件、依赖jar包、项目jar包都已打包



