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/hollowGlassModule/pom.xml | 3 hangzhoumesParent/moduleService/CacheGlassModule/pom.xml | 13 +- hangzhoumesParent/moduleService/CacheVerticalGlassModule/pom.xml | 3 hangzhoumesParent/moduleService/TemperingGlassModule/pom.xml | 3 hangzhoumesParent/gateway/pom.xml | 84 ++++++++++++++++++++ hangzhoumesParent/moduleService/GlassStorageModule/pom.xml | 3 hangzhoumesParent/moduleService/LoadGlassModule/pom.xml | 3 hangzhoumesParent/moduleService/pom.xml | 81 ++++++++++++++++++++ 8 files changed, 174 insertions(+), 19 deletions(-) diff --git a/hangzhoumesParent/gateway/pom.xml b/hangzhoumesParent/gateway/pom.xml index ec368a6..187fe4a 100644 --- a/hangzhoumesParent/gateway/pom.xml +++ b/hangzhoumesParent/gateway/pom.xml @@ -13,8 +13,7 @@ <artifactId>gateway</artifactId> <properties> - <maven.compiler.source>8</maven.compiler.source> - <maven.compiler.target>8</maven.compiler.target> + <java.run.main.class>com.mes.GateWayApplication</java.run.main.class> </properties> <dependencies> <!-- 鏈嶅姟娉ㄥ唽/鍙戠幇--> @@ -33,6 +32,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> diff --git a/hangzhoumesParent/moduleService/CacheGlassModule/pom.xml b/hangzhoumesParent/moduleService/CacheGlassModule/pom.xml index 974c18f..27a986a 100644 --- a/hangzhoumesParent/moduleService/CacheGlassModule/pom.xml +++ b/hangzhoumesParent/moduleService/CacheGlassModule/pom.xml @@ -23,16 +23,15 @@ <artifactId>jcifs</artifactId> <version>1.2.19</version> </dependency> -<!-- <dependency>--> -<!-- <groupId>com.github.yulichang</groupId>--> -<!-- <artifactId>mybatis-plus-join-boot-starter</artifactId>--> -<!-- <version>1.4.12</version>--> -<!-- </dependency>--> + <!-- <dependency>--> + <!-- <groupId>com.github.yulichang</groupId>--> + <!-- <artifactId>mybatis-plus-join-boot-starter</artifactId>--> + <!-- <version>1.4.12</version>--> + <!-- </dependency>--> </dependencies> <properties> - <maven.compiler.source>8</maven.compiler.source> - <maven.compiler.target>8</maven.compiler.target> + <java.run.main.class>com.mes.CacheGlassModuleApplication</java.run.main.class> </properties> diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/pom.xml b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/pom.xml index 955faaf..12fc18f 100644 --- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/pom.xml +++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/pom.xml @@ -19,8 +19,7 @@ </dependency> </dependencies> <properties> - <maven.compiler.source>8</maven.compiler.source> - <maven.compiler.target>8</maven.compiler.target> + <java.run.main.class>com.mes.CacheVerticalClassModuleApplication</java.run.main.class> </properties> </project> \ No newline at end of file diff --git a/hangzhoumesParent/moduleService/GlassStorageModule/pom.xml b/hangzhoumesParent/moduleService/GlassStorageModule/pom.xml index d0ed157..8312ab0 100644 --- a/hangzhoumesParent/moduleService/GlassStorageModule/pom.xml +++ b/hangzhoumesParent/moduleService/GlassStorageModule/pom.xml @@ -33,8 +33,7 @@ </dependencies> <properties> - <maven.compiler.source>8</maven.compiler.source> - <maven.compiler.target>8</maven.compiler.target> + <java.run.main.class>com.mes.GlassStorageApplication</java.run.main.class> </properties> </project> \ No newline at end of file diff --git a/hangzhoumesParent/moduleService/LoadGlassModule/pom.xml b/hangzhoumesParent/moduleService/LoadGlassModule/pom.xml index 1450378..e3bf389 100644 --- a/hangzhoumesParent/moduleService/LoadGlassModule/pom.xml +++ b/hangzhoumesParent/moduleService/LoadGlassModule/pom.xml @@ -26,8 +26,7 @@ </dependencies> <properties> - <maven.compiler.source>8</maven.compiler.source> - <maven.compiler.target>8</maven.compiler.target> + <java.run.main.class>com.mes.LoadGlassModuleApplication</java.run.main.class> </properties> </project> \ No newline at end of file diff --git a/hangzhoumesParent/moduleService/TemperingGlassModule/pom.xml b/hangzhoumesParent/moduleService/TemperingGlassModule/pom.xml index b2ee602..d0993e0 100644 --- a/hangzhoumesParent/moduleService/TemperingGlassModule/pom.xml +++ b/hangzhoumesParent/moduleService/TemperingGlassModule/pom.xml @@ -26,8 +26,7 @@ </dependencies> <properties> - <maven.compiler.source>8</maven.compiler.source> - <maven.compiler.target>8</maven.compiler.target> + <java.run.main.class>com.mes.TemperingGlassModuleApplication</java.run.main.class> </properties> </project> \ No newline at end of file diff --git a/hangzhoumesParent/moduleService/hollowGlassModule/pom.xml b/hangzhoumesParent/moduleService/hollowGlassModule/pom.xml index d6c101e..00438f7 100644 --- a/hangzhoumesParent/moduleService/hollowGlassModule/pom.xml +++ b/hangzhoumesParent/moduleService/hollowGlassModule/pom.xml @@ -12,8 +12,7 @@ <artifactId>hollowGlass</artifactId> <properties> - <maven.compiler.source>8</maven.compiler.source> - <maven.compiler.target>8</maven.compiler.target> + <java.run.main.class>com.mes.HollowGlassApplication</java.run.main.class> </properties> </project> \ No newline at end of file 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