Hi,

This is expected behaviour.
Test-sources see main-sources, not the contrary, and it's a very good thing.

Compiled test-sources logically don't get packaged inside the resulting
archive (say jar, war...).

If you want a resources accessible from main-sources, put them inside
src/main/resources, not src/test/resources.

Cheers

2011/8/5 Michel Jung <michel.jun...@gmail.com>

> Hi
>
> My test-classes folder is not in the classpath - neither in eclipse, nor
> when running the application with maven.
> I created a new sample app, like this:
>
> src/main/java/com/example/Main:
>
>    public static void main(final String[] args) {
>        System.out.println(Main.class.getResourceAsStream("/file.txt"));
>    }
>
> And a file:
> src/test/resources/file.txt
>
> This was tested on two different computers with different eclipse
> installations. The output is always the same: null.
> What's wrong? I thought I already had such code working. It's also
> described
> in
>
> http://maven.apache.org/guides/getting-started/index.html#How_do_I_add_resources_to_my_JAR
>
> Thanks in advance.
> Michel
>



-- 
Baptiste <Batmat> MATHUS - http://batmat.net
Sauvez un arbre,
Mangez un castor !

Reply via email to