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 ??

有帮助吗?

解决方案

It should be

src/test/resources

Not

src/test/resource

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top