how to make maven use test resources

前端 未结 2 680
心在旅途
心在旅途 2020-12-09 04:44

when I use the command: mvn test, maven uses the main resources instead of the test ones in src/test/resources.

How can i make maven use the test resources rather th

相关标签:
2条回答
  • 2020-12-09 05:39

    Can't you give it another name ?
    The Loader doesn't know that your resource.xml is in src/main/resources or src/test/resources, it's only a path to look for. I think the problem it's not Maven, this is how the Loader should and it works. From Maven would you expect to discard all classes/resources from src/main/resources when doing the test phase ?

    0 讨论(0)
  • 2020-12-09 05:42

    Please check your target/test-classes directory for resource.xml. Your file should be here. If you find this file, I think the same name is the problem. Try rename the file for example to test-resource.xml. If the file doesn't exists in the test-classes directory, you should configure resource management in the maven pom.xml. Use maven-resouce-plugin. Hope it helps.

    0 讨论(0)
提交回复
热议问题