I'm writing a little Maven application in Eclipse. I store some property files and my application context in the directory src/main/resources.
I now want to make Eclipse use properties in the directory src/test/resources. So when I run and debug the program in Eclipse, these test properties should be used.
Do you know how I could make that happen?
Use a test override (e.g. testOverrides.xml):
In your tests, make sure it's imported first:
Now put all your test properties in
src/test/resources/META-INF/spring/testproperties/
.You have to also make sure that the
main
placeholder configurer doesn't ever seetestproperties
, e.g. here's mine:It doesn't use the double-* wildcard, so will only look at that one directory.
I use the above method with great success.
Whether you use the Maven Eclipse Plugin or m2eclipse,
src/test/resources
precedessrc/main/resources
on the classpath (more precisely, their output directories). In other words, there is nothing to do, things just works as on the command line.Try this: