The class in project A is in src/java (I'm not using the default maven tree, 
but I have override those properties in my pom don't worry)

I tried with either test scope either compile scope in the dependency from 
project B to project A. The default scope is compile, is that true?

I've also tried mvn install but the error remains and it is practically the 
same as mvn test, that is project B cannot see a class of project A.

Thanks.
Raffaele

-----Original Message-----
From: Jim Sellers [mailto:[EMAIL PROTECTED]
Sent: martedì 11 settembre 2007 17.27
To: Maven Users List
Subject: Re: NoClassDeFoundError running unit test


"Project B uses a class from Project A in a unit test."

Where is this class in Project A?  Is it in src/main/java or src/test/java?
If it's in src/test/java you'll have to create a test jar:
http://maven.apache.org/guides/mini/guide-attached-tests.html

What is the scope of the dependency from Project B to Project A?

Have you tried mvn install on Project A first?

With maven, code in src/test can only "see" the code in src/main, but not
the other way around.  With eclipse your code in src/main/java can see
src/test/java.

HTH
Jim


On 9/11/07, GAMBELLI Raffaele <[EMAIL PROTECTED]> wrote:
>
> I'm using Maven 2.0.7
> I have two project, let's call them A and B.
> A has only external dependencies.
> B has external dependencies, but is also dependent on project A.
>
> Project B uses a class from Project A in a unit test.
>
> Running either "mvn test" or "mvn package"  from the project B level
> results in a
> java.lang.NoClassDefFoundError (it can't found the class defined in
> project A) during the unit test of project B.
>
> But, if I run directly unit test of project B from Eclipse, the unit test
> completes successfully. Why?
>
> Thanks in advance, regards.
> Raffaele
>
>
>
> ---------------------------------------------------------------------
> 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]

Reply via email to