Where in maven project's path should I put configuration files that are not considered resources

前端 未结 4 1270
温柔的废话
温柔的废话 2020-12-23 09:55

I have a simple java maven project. One of my classes when executing needs to load an xml configuration file from the classpath. I don\'t want to package such xml file when

4条回答
  •  醉酒成梦
    2020-12-23 10:16

    If your packaging is war, you can use the packagingExcudes configuration option of the maven-war-plugin:

    
      ...
      
        
          ...
          
            maven-war-plugin
            3.2.2
            
              
              
                WEB-INF/classes/abc.properties
              
            
          
          ...
        
      
      ...
    
    

    Use commas to separate between multiple resources you want to exclude. Also, you can use wildcards and regex in your excluded paths. For regex, it's in the %regex[YOUR_REGEX_HERE] syntax. Check the documentation for more details.

提交回复
热议问题