Question

I've standard maven project...

In src/main/java I've a class called MyResourceLoader.java that load some resource by name my_props.xml.

In src/test/resource, I've created this my_props.xml.

Now in src/test/java, I try to invoke the MyResourceLoader.java, but It cannot see my_props.xml..

How to make it visible ??

Was it helpful?

Solution

It should be

src/test/resources

Not

src/test/resource

OTHER TIPS

From @sotirios-delimanolis :

You put your resources in src/test/resources , and when you run it your aren't testing, you are running it, so maven compiles it and ignores the src/test directory.

Change it to src/main/resources and see if that fixes the problem, the src/main directotry is what is put into the actual jar.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top