I have maven project X which depends on project Y. when I run the tests on project X, it is not able to find the test files in project Y although it is in the class path.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The usual convention in Maven is to have the unit tests localy to your project which means you can’t use classes from outside the current project. This is coming also from the point that the test class will not be packaged into a jar in contradiction to the production code (src/main/java). But you can solve the problem by defining the class you would like to reuse like the following (project Y):
You have to do mvn install (or may be mvn deploy) and in project Y you have to use the above by defining it like the following: