In Maven how to exclude resources from the generated jar?

后端 未结 8 1152
余生分开走
余生分开走 2020-11-30 01:46

When I create an executable jar with dependencies (using this guide), all properties files are packaged into that jar too. How to stop it from happening? Thanks.

UPD

8条回答
  •  被撕碎了的回忆
    2020-11-30 02:19

    Another possibility is to use the Maven Shade Plugin, e.g. to exclude a logging properties file used only locally in your IDE:

    
        org.apache.maven.plugins
        maven-shade-plugin
        ${maven-shade-plugin-version}
        
            
                package
                
                    shade
                
                
                    
                        
                            *:*
                            
                                log4j2.xml
                            
                        
                    
                
            
        
    
    

    This will however exclude the files from every artifact, so it might not be feasible in every situation.

提交回复
热议问题