其他分享
首页 > 其他分享> > Spring Boot 分离打包

Spring Boot 分离打包

作者:互联网

1、首先打出正常的 jar 包,解压后将 lib 上传到服务器
2、修改 pom,重新打包

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <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-surefire-plugin</artifactId>
                <version>2.22.1</version>
                <configuration>
                    <skipTests>true</skipTests>
                </configuration>
            </plugin>
            <!--添加配置跳过测试-->
        </plugins>
    </build>

3、运行 jar 包

nohup java -Dloader.path=/www/wwwroot/lib -jar xxx.jar &

标签:lib,Spring,boot,Boot,jar,maven,nothing,org,打包
来源: https://blog.51cto.com/13559120/2576623