I'm using IDEA 8.1.2 and have noticed that the way IDEA copies files over prior to tests running has changed, and is now consistently breaking my tests when running through the IDE. Breifly, here is what I am doing.
- Test looks for a file on the classpath, lets call it "foo.properties". In the mvn2 source tree, this is in /src/test/resources and is copied to /target/test-classes - nothing special.
- foo.properties contains template text which is replaced by maven in the process-test-resources phase, before copying into the target directory
- IDEA's classpath is configured by the maven plugin, and I presume it looks at target/test-classes - NOT at src/test/resources (or it would never work)
To successfully run this test:
- The files in test/resources must have been filtered and copied (by previously running mvn process-test-resources or another phase that executes it)
- I can then use shift-ctrl-F10 to execute the test from the IDE, and since the classpath is configured to target/test-classes it picks up the previosuly filtered properties file and all is good
This approach works fine in IDEA 8.1.0, however, not in 8.1.2. When running the test from the IDE, instead of it using the "foo.properties" in target/test-classes as-is, IDEA is copying the template foo.properties from src/test/reources and blowing away whatever was there, before running the test, each time the test is run. That causes the test to fail because the it picks up the unfiltered (wrong) property values and I've been unable to find a way to stop IDEA doing that.
Is this a bug, or am I doing something wrong? I've reverted back to 8.1 for now to get going again. Thanks for any advice.