2022年6月

1、pom.xml修改如下:

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <mainClass>com.App</mainClass>
                <layout>ZIP</layout>
                <includes>
                    <include>
                        <groupId>nothing</groupId>
                        <artifactId>nothing</artifactId>
                    </include>
                </includes>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>repackage</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    <plugins>
<build>

2、然后使用cmd命令获得分离出来的lib

mvn dependency:copy-dependencies -DoutputDirectory=F:\lib  -DincludeScope=runtime

3、运行java

java -Dloader.path=/path/to/lib -jar /path/to/springboot-0.0.1-SNAPSHOT.jar