Maven - Add directory to classpath while executing tests

后端 未结 6 1165
北海茫月
北海茫月 2020-12-02 15:29

The Junits I have in my project need to load property files from the classpath. How can I specify the directory of those property files so that Maven will set that in the cl

6条回答
  •  一个人的身影
    2020-12-02 16:13

    You can also add new test resource folders.

    
        
            
                ${project.basedir}/src/test/resources
            
            
                ${project.basedir}/src/test/something_else
            
        
    
    

    The first path, src/test/resources, is the default. Assuming you still want the default path to be used, make sure it's included. (The testResources tag overwrites your defaults, so if you don't include the default path explicitly, it will stop being used.)

提交回复
热议问题