I get an error when i try to run my unittest, because they can't find my resource files.
They are located at:
As I understand it from this post I need to add this path to my test classpath so that it's avaliable to the tests too.
But I can't figure out what file, menu or property i need to edit to set it.
I am using Netbeans 7.2 and Maven for a JSF project.
Can anyone give me som decent instructions on how to add this path to the test classpath in this environment.
Resources used only by testing should go in src/test/resources, not src/main/resources.
Maven will automatically copy the resources when it runs the tests. You do not have to specify anything.
An IDE is no substitute for an Intelligent Developer.
Joined: Sep 30, 2012
Thanks for reply.
I don't have any resources used only by testing, only my regular resources that are located in src/main/resources.
I guess I must have something configured wrong in that case, because my test methods can't find the resources.
Do I have to manually create the src/test/resources for maven to copy the files there when the tests run?
Maven copies to the "target" directory when building and when testing. Nowhere else. A "mvn clean" destroys that directory and all its subdirectories".
There are exceptions to src/xxxx/resources if you are building something other than a basic jar. In particular, a WAR build pulls its resources from src/main/webapp, and copies them into the resulting webapp relative to its root (not its /WEB-INF/classes).