|
|
@@ -76,7 +76,92 @@
|
|
|
</dependencies>
|
|
|
|
|
|
<build>
|
|
|
+ <!--2023/07/21 start 由于程序源代码不需要修改 ,只需要变更配置文件,修改发布时候配置文件外置 -->
|
|
|
+ <!-- 控制resources资源文件的拷贝, -->
|
|
|
+ <!-- 这里需要配置两个resource -->
|
|
|
+ <!-- 一个resource控制把配置文件放在target目录下用于调试 -->
|
|
|
+ <!-- 一个resource控制把配置文件放在target/config目录下用于部署生产环境 -->
|
|
|
+ <resources>
|
|
|
+ <!-- 配置文件复制到target目录下,不然开发调试的时候会报错 -->
|
|
|
+ <resource>
|
|
|
+ <!-- 配置文件复制到target目录下,不然开发调试的时候会报错 -->
|
|
|
+ <directory>src/main/resources</directory>
|
|
|
+ <!-- 是否对资源文件进行过滤 -->
|
|
|
+ <filtering>true</filtering>
|
|
|
+ <!-- 这里没有配置targetPath,默认复制到outputDirectory目录下 -->
|
|
|
+ </resource>
|
|
|
+ <!-- 配置文件放在target/config目录下 -->
|
|
|
+ <resource>
|
|
|
+ <directory>src/main/resources</directory>
|
|
|
+ <targetPath>${project.build.directory}/config</targetPath>
|
|
|
+ </resource>
|
|
|
+ </resources>
|
|
|
+ <!--2023/07/21 end-->
|
|
|
<plugins>
|
|
|
+ <!--2023/07/21 start-->
|
|
|
+ <plugin>
|
|
|
+ <groupId>org.apache.maven.plugins</groupId>
|
|
|
+ <artifactId>maven-jar-plugin</artifactId>
|
|
|
+ <version>3.1.0</version>
|
|
|
+ <configuration>
|
|
|
+ <archive>
|
|
|
+ <addMavenDescriptor>false</addMavenDescriptor>
|
|
|
+ <!-- 清单文件 -->
|
|
|
+ <!-- 打包jar文件时,配置manifest文件,加入lib包的jar依赖 -->
|
|
|
+ <manifest>
|
|
|
+ <mainClass>com.xxl.job.admin.XxlJobAdminApplication</mainClass>
|
|
|
+ <addClasspath>true</addClasspath>
|
|
|
+ <classpathPrefix>lib/</classpathPrefix>
|
|
|
+ </manifest>
|
|
|
+ <!-- 配置文件外置,需要把配置文件目录加入到classpath -->
|
|
|
+ <manifestEntries>
|
|
|
+ <Class-Path>config/</Class-Path>
|
|
|
+ </manifestEntries>
|
|
|
+ </archive>
|
|
|
+ <!-- 指定需要把哪些文件打入到jar包中, -->
|
|
|
+ <!-- ** 代表jar包根目录 -->
|
|
|
+ <!-- **/com/ 代表jar包根目录下仅包含com目录(我所有的程序都在com包下), 当然打好之后还会包含生成的manifest目录 -->
|
|
|
+ <!-- 注意com后面的/一定不要省去,不然maven会认为这是一个文件名 -->
|
|
|
+ <!-- includes或者excludes一定要指定,不然会把target下所有的文件都打进去 -->
|
|
|
+ <includes>
|
|
|
+ <include>**/com/</include>
|
|
|
+ </includes>
|
|
|
+ <excludes>
|
|
|
+ <exclude>**/mappings/</exclude>
|
|
|
+ </excludes>
|
|
|
+ </configuration>
|
|
|
+ </plugin>
|
|
|
+ <!-- 拷贝依赖的jar包到lib目录 -->
|
|
|
+ <plugin>
|
|
|
+ <groupId>org.apache.maven.plugins</groupId>
|
|
|
+ <artifactId>maven-dependency-plugin</artifactId>
|
|
|
+ <version>3.1.0</version>
|
|
|
+ <executions>
|
|
|
+ <execution>
|
|
|
+ <id>copy</id>
|
|
|
+ <phase>package</phase>
|
|
|
+ <goals>
|
|
|
+ <goal>copy-dependencies</goal>
|
|
|
+ </goals>
|
|
|
+ <configuration>
|
|
|
+ <!-- 拷贝依赖的jar包到lib目录 -->
|
|
|
+ <outputDirectory>
|
|
|
+ ${project.build.directory}/lib
|
|
|
+ </outputDirectory>
|
|
|
+ </configuration>
|
|
|
+ </execution>
|
|
|
+ </executions>
|
|
|
+ </plugin>
|
|
|
+ <!-- 解决资源文件的编码问题 -->
|
|
|
+ <plugin>
|
|
|
+ <groupId>org.apache.maven.plugins</groupId>
|
|
|
+ <artifactId>maven-resources-plugin</artifactId>
|
|
|
+ <version>3.1.0</version>
|
|
|
+ <configuration>
|
|
|
+ <encoding>UTF-8</encoding>
|
|
|
+ </configuration>
|
|
|
+ </plugin>
|
|
|
+ <!--2023/07/21 end-->
|
|
|
<plugin>
|
|
|
<groupId>org.springframework.boot</groupId>
|
|
|
<artifactId>spring-boot-maven-plugin</artifactId>
|