How to pack resources in a Maven Project?

前端 未结 3 1717
独厮守ぢ
独厮守ぢ 2020-12-15 13:54

I am looking for suggestion in putting image file maven web project. One of classes under src/main/java need to use an image file. My problem is, if i put image file under s

3条回答
  •  生来不讨喜
    2020-12-15 13:58

    You can use maven-resources-plugin to copy things to desired location.

    something like this

    
          maven-resources-plugin
          2.5
          
            
              copy-resources
                
                validate
                
                  copy-resources
                
                
                  
                              
                      
                        
                       
                                
                      
              
            
          
    

    EDIT: based on your comment below, i think what you need is a properties file where you maintain path to the resources folder. That path will be an absolute path. Depending on your deployment you change that path in the properties file.

提交回复
热议问题