I haven’t been programming for a while, and I come back to it, and I ran into a very difficult problem. In the past, when I compiled test code from Maven, it would copy all of my * .xml resource files contained in the test sources tree to target/test-classes
. But last night, in my current project, it was not so long that I did not expect. Whenever I ran my tests through Maven or Intellij IDEA, the tests failed because they could not find any * .xml files in the class path - they were never copied.
I have old projects on my computer using the exact same .pom file and project structure, and the * .xml files are copied in order.
To solve this problem, I included the following XML in my Maven MOM:
<testResources> <testResource> <directory>src/test/java</directory> <filtering>false</filtering> <includes> <include>**/*.xml</include> </includes> </testResource> </testResources>
While this solves the problem, I'm still wondering why I had to go out of my way to tell Maven to copy * .xml files from my test source tree to the target / test class directory manually. As I said, every other old project for the last 2 years copies * .xml files without specifying testResources
.
What could be causing this behavior?
source share