springboot打包jar,因为是压缩jar,所有读取resource配置文件有问题,现在用下面方法构建,每次编码后jar不到1M,读取配置文件不报错

springboot打包jar,因为是压缩jar,所有读取resource配置文件有问题,现在用下面方法构建,每次编码后jar不到1M,读取配置文件不报错
1,maven配置,打包

    
    ahsj-web
    
        
            src/main/java
            false
            
                **/*.java
            
        
    
    
        
            org.apache.maven.plugins
            maven-surefire-plugin
            
                true
            
        

        
            maven-compiler-plugin
            
                1.8
                1.8
                UTF-8
            
        
        
        
            maven-assembly-plugin
            
                false
                
                    
                    assembly.xml
                
                
                ${project.build.directory}/dist/
            
            
                
                    make-assembly
                    package
                    
                        single
                    
                
            
        
        
            org.apache.maven.plugins
            maven-jar-plugin
            3.1.0
            
                
                    
                        
                        link.ahsj.target.Application
                        lib/
                        true
                    
                    
                        resources/
                    
                
            
        
    

2,assembly.xml 和pom.xml是同一级目录



    distribution
    
        dir
    

    false

    
        
        
            src/main/resources/
            /resources
        
        
            bin/
            /
        
    

    
        
        
            /lib
            runtime
            
                ${project.groupId}:${project.artifactId}
            
        
        
            /
            
                ${project.groupId}:${project.artifactId}
            
        
    

其他人贡献gitee地址:https://gitee.com/chenshiyun/springboot-assembly-mybatis.git

你可能感兴趣的:(springCloud,springboot,java,后端)