You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Tournié Jean-Michel <je...@dlconsultant.fr> on 2005/06/15 11:11:38 UTC
[m2] JUnit test using files, with multiple modules
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 dont 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
Posted by Tournié Jean-Michel <je...@dlconsultant.fr>.
The solution 2 using basedir system property works fine whith m2.
Thank you Nicolas.
J-Michel
-----Message d'origine-----
De : Nicolas Chalumeau [mailto:nicolas.chalumeau@gmail.com]
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 <je...@dlconsultant.fr>:
> 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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: [m2] JUnit test using files, with multiple modules
Posted by Nicolas Chalumeau <ni...@gmail.com>.
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 <je...@dlconsultant.fr>:
> 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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org