Maven 分离lib和resource的打包配置

使用Maven打包并分离resource,只需两步:

1、修改项目根目录下的pom.xml

            
                org.apache.maven.plugins
                maven-assembly-plugin
                3.3.0
                
                    false
                    
                        
                        assembly.xml
                    
                    
                    ${project.build.directory}/dist/
                
                
                    
                        make-assembly
                        package
                        
                            single
                        
                    
                
            

            
            
                org.apache.maven.plugins
                maven-jar-plugin
                3.0.2
                
                    
                        
                            
                            xxx.xxx.Main
                            
                            lib/
                            true
                        
                        
                            resources/
                        
                    
                
            

2、添加assembly.xml在项目根目录下



    distribution

    
    
        zip
    

    false

    
    
        
            src/main/resources/
            
            
                mybatis/**
            
            /resources
        
    

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

你可能感兴趣的:(散记,java,maven)