You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "David G. Paschich" <da...@reactivity.com> on 2006/09/07 02:25:21 UTC

Maven1.1 is adding jars I don't want to my unit test classpath

Quick summary:  It appears that the Maven test module in Maven 1.1 beta 3 is
adding, among other things, log4j and Xerces to my classpath before running
unit tests.  Can I get it to stop?  I tried setting
maven.test.excludeXmlApis to "yes" but that had no effect.

Why do I want to do this?

I do most of my development using Eclipse, and had an existing project which
uses Maven 1.1 to build.  I ran "maven eclipse", loaded it up, and then ran
the unit tests, which failed with an error indicating that a class in Apache
commons-logging was missing.  But at the command line, the unit tests
succeeded without error.

After doing some digging, I added explicit dependencies on commons-logging
and log4j to my project.xml, re-ran "maven eclipse", and now the tests run
fine in Eclipse.

Here's my concern.  I didn't list these packages as dependencies in my
project, but Maven added them to my classpath anyway when running unit
tests.  However, this code is going to get eventually deployed in an
environment where those packages may or may not be present, in versions
which may or may not be compatible with the ones Maven so helpfully added
for me.   So now I don't entirely trust my unit tests -- I would much rather
have them fail if they need a jar not explicitly listed in the project
dependencies to run.

Can anyone help me out here?  The only knobs I see in the test plugin
documentation which seem relevant are maven.junit.fork and
maven.test.excludeXmlApis -- I tried all 4 combinations of "yes" and "no"
for those two values and still see the problem occuring.  I'm using Java
1.4.2.

Thanks,

-- 
David G. Paschich
david@reactivity.com





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven1.1 is adding jars I don't want to my unit test classpath

Posted by Arnaud HERITIER <ah...@gmail.com>.
I can't have a look at this now.
Can you open an issue on Jira please ?
http://jira.codehaus.org/browse/MPTEST

thanks.

Arnaud

On 9/7/06, David G. Paschich <da...@reactivity.com> wrote:
>
> Quick summary:  It appears that the Maven test module in Maven 1.1 beta 3
> is
> adding, among other things, log4j and Xerces to my classpath before
> running
> unit tests.  Can I get it to stop?  I tried setting
> maven.test.excludeXmlApis to "yes" but that had no effect.
>
> Why do I want to do this?
>
> I do most of my development using Eclipse, and had an existing project
> which
> uses Maven 1.1 to build.  I ran "maven eclipse", loaded it up, and then
> ran
> the unit tests, which failed with an error indicating that a class in
> Apache
> commons-logging was missing.  But at the command line, the unit tests
> succeeded without error.
>
> After doing some digging, I added explicit dependencies on commons-logging
> and log4j to my project.xml, re-ran "maven eclipse", and now the tests run
> fine in Eclipse.
>
> Here's my concern.  I didn't list these packages as dependencies in my
> project, but Maven added them to my classpath anyway when running unit
> tests.  However, this code is going to get eventually deployed in an
> environment where those packages may or may not be present, in versions
> which may or may not be compatible with the ones Maven so helpfully added
> for me.   So now I don't entirely trust my unit tests -- I would much
> rather
> have them fail if they need a jar not explicitly listed in the project
> dependencies to run.
>
> Can anyone help me out here?  The only knobs I see in the test plugin
> documentation which seem relevant are maven.junit.fork and
> maven.test.excludeXmlApis -- I tried all 4 combinations of "yes" and "no"
> for those two values and still see the problem occuring.  I'm using Java
> 1.4.2.
>
> Thanks,
>
> --
> David G. Paschich
> david@reactivity.com
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>