How can I write maven build to add resources to classpath?

后端 未结 3 1119
鱼传尺愫
鱼传尺愫 2020-12-04 21:56

I am building a jar using maven with simple maven install. If I add a file to src/main/resources it can be found on the classpath but it has a config folder whe

3条回答
  •  暖寄归人
    2020-12-04 22:22

    By default maven does not include any files from "src/main/java".

    You have two possible way to that.

    1. put all your resource files (different than java files) to "src/main/resources" - this is highly recommended

    2. Add to your pom (resource plugin):

     
           
               src/main/resources
            
                
                    src/main/java
                    
                        **/*.xml
                    
                
      
    

提交回复
热议问题