SpringBoot生产环境打包去除无用依赖

1、去除在生产环境中不变的依赖第三方jar包

pom.xml中添加:


    org.springframework.boot
    spring-boot-maven-plugin
    
        ZIP
        
        
            org.springframework.boot,
            org.springframework,
            org.springframework.data,
            com.fasterxml.jackson.core,
            com.fasterxml.jackson.databind,
            org.apache.commons,
            org.apache.tomcat.embed,
            org.hibernate.validator,
            org.slf4j,
            com.jayway,
            org.jboss,
            com.alibaba,
            com.fasterxml,
            com.fasterxml.jackson.datatype,
            com.fasterxml.jackson.module,
            ch.qos.logback,
            org.yaml,
            org.jboss.logging,
            javax.validation,
            io.netty,
            org.apache.httpcomponents,
            org.apache.logging.log4j,
            org.aspectj,
            javax.annotation,
            io.lettuce,
            commons-codec,
            org.reactivestreams,
            io.projectreactor
        
    

2、去除生产环境配置文件依赖

pom.xml中添加:

<resources>
    <resource>
        <directory>src/main/resourcesdirectory>
        <excludes>
            <exclude>*exclude>
        excludes>
        <filtering>truefiltering>
    resource>
resources>

你可能感兴趣的:(项目问题)