一、第一种Maven打包方式,将jar及resources下全部配置文件,拷贝到指定目录:
E:/IDEAFile/file-copy/target/project org.springframework.boot spring-boot-maven-plugin org.apache.maven.plugins maven-jar-plugin 2.6 true lib/ com.example.filecopy.FileCopyApplication maven-resources-plugin copy-resources validate copy-resources ${project.build.directory}/project src/main/resources true maven-antrun-plugin package run
第二种Maven打包方式使用 assembly插件,将jar及配置文件进行压缩打包到指定目录:
org.springframework.boot spring-boot-maven-plugin org.apache.maven.plugins maven-jar-plugin 2.6 true lib/ com.example.filecopy.FileCopyApplication org.apache.maven.plugins maven-assembly-plugin 2.4 project /assembly/assembly.xml ${project.build.directory} false package single
assembly文件:
leaves zip true ${basedir}/src/main/resources ** true ${file.separator} ${project.build.directory} ${file.separator} *.jar