try putting your mapping_common.hbm.xml on "src/main/resources/" instead.
   or modify your getResourceAsStream to get the file
"META-INF/mapping_common.hbm.xml"

   resources are searched on all the classpaths, normally META-INF is
added to the classpath
   so getClass().getResourceAsStream("mapping_common.hbm.xml") would
normally work
   if you're using a jar. But for your unit test it is not, only
target/classes is added to your classpath.
   you need to specify the directory it is in which is META-INF. 
correct me if i'm wrong. =)



christophe blin wrote:
> Hi,
>
> I am new to maven so excuse me if the questions have already been posted
> (I do not find a related in the archives so I think it has not been so).
>
> I am working with maven2 and hibernate.
> My hibernate mapping is in /src/main/resources/META-INF :
> mapping_common.hbm.xml
>
> First question :
> if I manually copy this file into /src/test/resources and I do (as
> stated in the docs getting started) :
>     InputStream is =
> getClass().getResourceAsStream("mapping_common.hbm.xml");
>     assert(is != null);
> the assertion is thrown.
>
> Am I doing something wrong or Should I configure something in the pom to
> use src/test/resources as the resources directory for the unit tests ?
>
> Second question :
> I'd like to use the same mapping file when doing unit tests.
> How can I configure the pom in order to perform a copy of the file just
> before the execution of the test goal ?
>
> Thanks and regards,
> chris
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to