You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by nitingupta183 <ni...@gmail.com> on 2010/09/14 16:00:16 UTC
Class loading issues while running tests
Hi All,
I have got a multi-project setup in which one project is acting as a parent
project. Test classes in few of my projects are dependent upon test classes
on other projects. I have resolved the test classes dependency with the help
of maven-jar-plugin ( goal test-jar) & by importing the test classifier
dependency in test scope in the dependent project.
Individual test cases run absolutely fine. However, when I run package,
test, install targets on my dependent project, they fail. The reason that is
coming out in logs is a test failure. Exactly those tests are failing which
have dependency on other project's test classes. No class def found.
Please help me in solving this issue. i am using surefire plugin for running
tests.
--
View this message in context: http://maven.40175.n5.nabble.com/Class-loading-issues-while-running-tests-tp2839157p2839157.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Class loading issues while running tests
Posted by Anders Hammar <an...@hammar.net>.
This problem comes from the fact that you have a test scope dependency. The
dependencies of that dependency that are in test scope will not be
transitive dependencies. Thus, no class def found.
The basic issue here is that you have more than one artifact of a Maven
project (the primary artifact and the test-jar artifact), but there is only
one pom and thus only one set of dependencies (the same for both artifacts).
My advice is to create two projects. I see this issue very often and the
best way to solve this is to go with two projects IMO.
Or you have to declare these dependencies explicitly in your project that
uses the test-jar. But that will make your dependency management more
complicated (cluttered).
Btw, you shouldn't use tests classifier but rather test-jar as type.
/Anders
On Tue, Sep 14, 2010 at 21:59, per-henrik hedman <ph...@gmail.com> wrote:
> If you run:
> mvn -X test
> you should be able to decipher your classpath during the test-phase
> and see whats missing.
> Cheers,
> Per-Henrik
>
> On Tue, Sep 14, 2010 at 4:00 PM, nitingupta183 <ni...@gmail.com>
> wrote:
> >
> > Hi All,
> >
> > I have got a multi-project setup in which one project is acting as a
> parent
> > project. Test classes in few of my projects are dependent upon test
> classes
> > on other projects. I have resolved the test classes dependency with the
> help
> > of maven-jar-plugin ( goal test-jar) & by importing the test classifier
> > dependency in test scope in the dependent project.
> >
> > Individual test cases run absolutely fine. However, when I run package,
> > test, install targets on my dependent project, they fail. The reason that
> is
> > coming out in logs is a test failure. Exactly those tests are failing
> which
> > have dependency on other project's test classes. No class def found.
> >
> > Please help me in solving this issue. i am using surefire plugin for
> running
> > tests.
> > --
> > View this message in context:
> http://maven.40175.n5.nabble.com/Class-loading-issues-while-running-tests-tp2839157p2839157.html
> > Sent from the Maven - Users mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > 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: Class loading issues while running tests
Posted by per-henrik hedman <ph...@gmail.com>.
If you run:
mvn -X test
you should be able to decipher your classpath during the test-phase
and see whats missing.
Cheers,
Per-Henrik
On Tue, Sep 14, 2010 at 4:00 PM, nitingupta183 <ni...@gmail.com> wrote:
>
> Hi All,
>
> I have got a multi-project setup in which one project is acting as a parent
> project. Test classes in few of my projects are dependent upon test classes
> on other projects. I have resolved the test classes dependency with the help
> of maven-jar-plugin ( goal test-jar) & by importing the test classifier
> dependency in test scope in the dependent project.
>
> Individual test cases run absolutely fine. However, when I run package,
> test, install targets on my dependent project, they fail. The reason that is
> coming out in logs is a test failure. Exactly those tests are failing which
> have dependency on other project's test classes. No class def found.
>
> Please help me in solving this issue. i am using surefire plugin for running
> tests.
> --
> View this message in context: http://maven.40175.n5.nabble.com/Class-loading-issues-while-running-tests-tp2839157p2839157.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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