[m2] JUnit test using files, with multiple modules

2005-06-15 Thread Tournié Jean-Michel
Hello all,

 

I have a problem using m2, when I execute a JUnit test who loads a
configuration file, in a multiple modules project.

 

My project structure is :

 

my-app

  +- pom.xml

  +- my-module1

 +- pom.xml

 +- src

 +- config-test

 +- my-file.txt - This file is load by test classes, by name
“config-test/my-file.txt”

 

 

When I run the command “m2 test” from “my-module1” directory, tests are OK.

When I run the command “m2 test” from “my-app” directory, tests FAILED
because test classes don’t found “config-test/my-file.txt”. The base dir is
“my-app”, not “my-app/my-module1”.

 

How can I solve my problem?

 

 

Thanks,

Jean-Michel 



RE: [m2] JUnit test using files, with multiple modules

2005-06-15 Thread Tournié Jean-Michel
The solution 2 using basedir system property works fine whith m2.

Thank you Nicolas.

J-Michel

-Message d'origine-
De : Nicolas Chalumeau [mailto:[EMAIL PROTECTED] 
Envoyé : mercredi 15 juin 2005 11:47
À : Maven Users List
Objet : Re: [m2] JUnit test using files, with multiple modules

2 solutions I think :
1/ use the resources in the pom to locate your file in the test classpath
2/ use the basedir system properties to find the test file. I did not
use this solution but using maven 1 with multiproject I needed to add
${basedir}/myResources to don't have the same problem that's probably
the same thing in m2

Nicolas

2005/6/15, Tournié Jean-Michel [EMAIL PROTECTED]:
 Hello all,
 
 I have a problem using m2, when I execute a JUnit test who loads a
 configuration file, in a multiple modules project.
 
 My project structure is :
 
 my-app
 
   +- pom.xml
 
   +- my-module1
 
  +- pom.xml
 
  +- src
 
  +- config-test
 
  +- my-file.txt - This file is load by test classes, by name
 config-test/my-file.txt
 
 When I run the command m2 test from my-module1 directory, tests are
OK.
 
 When I run the command m2 test from my-app directory, tests FAILED
 because test classes don't found config-test/my-file.txt. The base dir
is
 my-app, not my-app/my-module1.
 
 How can I solve my problem?
 
 Thanks,
 
 Jean-Michel
 


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





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