改动之前5分钟,改动之后
[2024-04-11 13:43:37.100]
[2024-04-11 13:44:16.849]
这里涉及两个打包插件
maven-dependency-plugin和spring-boot-maven-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>prepare-package</phase> <goals> <goal>copy-dependencies</goal> </goals> <configuration> <outputDirectory>${project.build.directory}/lib</outputDirectory> </configuration> </execution> </executions> </plugin>
精简jar体积
<plugin> <configuration> <includeSystemScope>true</includeSystemScope> </configuration> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>${spring-boot.version}</version> <executions> <execution> <id>repackage</id> <configuration> <skip>true</skip> </configuration> </execution> </executions> </plugin>
这里的启动命令需要调整
java -cp "a.jar;lib/*" com.java.Application
其中com.java.Application为启动类的路径
标签:java,springboot,plugin,spring,boot,maven,精简,打包 From: https://www.cnblogs.com/q202105271618/p/18129338