首页 > 其他分享 >springboot应用瘦身

springboot应用瘦身

时间:2023-03-24 13:57:46浏览次数:39  
标签:springboot lib boot jar 应用 nothing path 瘦身

1、将依赖的jar包存放到其他路径

mvn dependency:copy-dependencies -DoutputDirectory=lib_path -DincludeScope=runtime

2、在pom文件添加插件属性属性

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
        <mainClass>com.jiawa.blog.config.BlogApplication</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>

3、运行应用jar包

java -Dloader.path=lib_path -jar target/xxx.jar

标签:springboot,lib,boot,jar,应用,nothing,path,瘦身
From: https://www.cnblogs.com/codechange/p/17251307.html

相关文章