From 40c8f926742ac885981e1791291b77b8fd662163 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期五, 23 五月 2025 14:55:10 +0800
Subject: [PATCH] 1、编辑打包方式,避免生成的jar过大在升级过程耗费大量时间 将target下的config、lib和jar 统一放在同一目录下,修改服务启动命令 后续升级在不修改依赖、配置文件的情况下替换jar即可 涉及依赖、配置文件仅需在lib、config下新增/替换相关文件即可
---
hangzhoumesParent/moduleService/pom.xml | 81 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 81 insertions(+), 0 deletions(-)
diff --git a/hangzhoumesParent/moduleService/pom.xml b/hangzhoumesParent/moduleService/pom.xml
index 23bb38b..b868248 100644
--- a/hangzhoumesParent/moduleService/pom.xml
+++ b/hangzhoumesParent/moduleService/pom.xml
@@ -80,6 +80,87 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
+ <version>2.3.0.RELEASE</version> <!-- 鏍规嵁浣犵殑Spring Boot鐗堟湰璋冩暣 -->
+ <configuration>
+ <layout>ZIP</layout>
+ <includes>
+ <include>
+ <groupId>nothing</groupId>
+ <artifactId>nothing</artifactId>
+ </include>
+ </includes>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>3.1.2</version>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <phase>package</phase>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.directory}/lib</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>false</overWriteSnapshots>
+ <overWriteIfNewer>true</overWriteIfNewer>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>3.2.0</version>
+ <executions>
+ <execution>
+ <id>copy-resources</id>
+ <phase>package</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.directory}/config</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>3.2.0</version>
+ <configuration>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ <classpathPrefix>lib/</classpathPrefix>
+ <mainClass>${java.run.main.class}</mainClass>
+ </manifest>
+ <manifestEntries>
+ <Class-Path>resources/</Class-Path>
+ </manifestEntries>
+ </archive>
+ <outputDirectory>${project.build.directory}</outputDirectory>
+ </configuration>
</plugin>
</plugins>
</build>
--
Gitblit v1.8.0