<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<!--打包jar-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<!--MANIFEST.MF 中 Class-Path 加入前缀-->
<classpathPrefix>lib/</classpathPrefix>
<!--jar包不包含唯一版本标识-->
<useUniqueVersions>false</useUniqueVersions>
<!--指定入口类-->
<mainClass>com.xx.xx.xx.xxApplication</mainClass>
</manifest>
<manifestEntries>
<!--MANIFEST.MF 中 Class-Path 加入资源文件目录-->
<Class-Path>../config/${project.artifactId}/</Class-Path>
</manifestEntries>
</archive>
<!-- 排查内部的配置文件 -->
<excludes>
<exclude>**/*.yml</exclude>
</excludes>
<outputDirectory>${project.basedir}../../build/packages/lib/</outputDirectory>
</configuration>
</plugin>
<!--拷贝依赖 copy-dependencies-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>
${project.basedir}../../build/packages/lib/lib
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<!--拷贝资源文件 copy-resources-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-bin</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}../../build/packages/bin/${project.artifactId}</outputDirectory>
<resources>
<!-- 控制启动脚本文件的拷贝-->
<resource>
<directory>${project.basedir}../../build/template/bin-template</directory>
<includes>
<include>**/*.bat</include>
<include>**/*.sh</include>
</includes>
<filtering>true</filtering>
<targetPath>${project.basedir}../../build/packages/bin/${project.artifactId}</targetPath>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-config</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.yml</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
<outputDirectory>${project.basedir}../../build/packages/config/${project.artifactId}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<!--spring boot repackage,依赖 maven-jar-plugin 打包的jar包 重新打包成 spring boot 的jar包-->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.3.7.RELEASE</version>
<configuration>
<executable>true</executable>
<layout>ZIP</layout>
<!--将下面三个模块的jar包,打包到核心包中-->
<includes>
<include>
<groupId>nothing</groupId>
<artifactId>nothing</artifactId>
</include>
</includes>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>