The my.properties
file from my source (src/main/resources
) folder keepa getting picked up and used when I try to run my JerseyTest
... whereas I would like the properties files in the test folder (src/test/resources
) to be utilized.
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
try {
myProperties.load(classLoader.getResourceAsStream("my.properties"));
}
How can I configure this in Maven?
I'm using:
maven-compiler-plugin
version2.1
jersey-test-framework-grizzly2
version1.13
UPDATE (Resolved based on accepted answer):
I noticed the text skip non existing resourceDirectory
:
[INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) @ xxx ---
[WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /xxx/xxx/xxx/xxx/src/test/resources
Turns out that I had misspelled resources, after fixing it, everything works as outlined in the accepted answer.
While I was wasting my time looking for workarounds, I did find some interesting links for configuring properties files based on profiles: