You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Cary Coulter <ca...@hotmail.com> on 2004/01/08 20:50:25 UTC

Dependency issues for junit tests

How can I specify additional dependent jars for junit tests?

The main application code (non-junit classes) does not need (nor do we want
the developers to compile against) several lower level application jars
(stuff we have built wrappers for to isolate them from our code).

However, in order to run the junit tests, the project needs access to the
wrapper jars dependencies.  Different projects might need a different list
of these dependent (non-compile against) jars.

I can't find a means in the project.xml or project.properties to specify the
jars to only be used for junit testing.

Any ideas?



Thanks in advance,
Cary

Learning Maven and liking it.

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


Re: Dependency issues for junit tests

Posted by Jason van Zyl <jv...@maven.org>.
On Thu, 2004-01-08 at 15:41, Jason van Zyl wrote:

> If you do the following:
> 
> <dependency>
>   <groupId>foo</groupId>
>   <artifactId>bar</artifactId>
>   <type>test</type>
>   <version>1.0</version>
> </dependency>
> 
> You can make the distinction. Currently a type that corresponds to "jar"
> and "ejb" will be added to the classpath. So by specifying a type other
> than those they will be excluded from the classpath.

I'll correct myself here: the type "test" gets wedged into the "jar"
type so even dependencies marked as type "test" will make it into the
classpath. Going to take a crack at making a compatible change that will
allow test dependencies to actually be separated.


-- 
jvz.

Jason van Zyl
jason@zenplex.com
http://tambora.zenplex.org

In short, man creates for himself a new religion of a rational
and technical order to justify his work and to be justified in it.
  
  -- Jacques Ellul, The Technological Society


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


Re: Dependency issues for junit tests

Posted by di...@multitask.com.au.
"Cary Coulter" <ca...@hotmail.com> wrote on 09/01/2004 11:29:38 AM:

> Wouldn't it just be better to add the <dependencies>...</dependencies> 
to
> the <unitTest> block rather than adding some type of property
> <type>test</type>" to the regular <dependencies>...</dependencies> 
area??

That makes lots of sense.
--
dIon Gillard, Multitask Consulting
Blog:      http://blogs.codehaus.org/people/dion/





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


Re: Dependency issues for junit tests

Posted by Cary Coulter <ca...@hotmail.com>.
Wouldn't it just be better to add the <dependencies>...</dependencies> to
the <unitTest> block rather than adding some type of property
<type>test</type>" to the regular <dependencies>...</dependencies> area??

I'd would be glad to try to test something, but I'm still pretty green with
Maven.  If I can just update the "test" plugin in the standard 1.0-rc1
world, I can probably manage it.

Like this (I just found the <resource> needed to include my *.xml in the
TEST only path.

        <unitTest>
            <includes>
                <include>**/**Test.java</include>
            </includes>
            <excludes>
                <exclude></exclude>
            </excludes>
            <resources>
                <resource>
                    <directory>source/test</directory>
                    <include>**/*.xml</include>
                </resource>
            </resources>
           <dependencies>
              <dependency>
                    <groupId>xxx-yyy</groupId>
                    <artifactId>test-dep1-code</artifactId>
                    <version>3.2.0</version>
               </dependency>
              <dependency>
                    <groupId>xxx-yyy</groupId>
                    <artifactId>test-dep2-code</artifactId>
                    <version>1.2.3</version>
               </dependency>
            </dependencies>
        </unitTest>


test-dep1-code.2.3.0.jar and test-dep2-code.1.2.3.jar would only be added to
the classpath during junit runs.

Thanks for your interest -- and any help you can give.
Cary


----- Original Message ----- 
From: "Jason van Zyl" <jv...@maven.org>
To: "Maven Users List" <us...@maven.apache.org>
Sent: Thursday, January 08, 2004 2:41 PM
Subject: Re: Dependency issues for junit tests


> On Thu, 2004-01-08 at 14:50, Cary Coulter wrote:
> > How can I specify additional dependent jars for junit tests?
> >
> > The main application code (non-junit classes) does not need (nor do we
want
> > the developers to compile against) several lower level application jars
> > (stuff we have built wrappers for to isolate them from our code).
> >
> > However, in order to run the junit tests, the project needs access to
the
> > wrapper jars dependencies.  Different projects might need a different
list
> > of these dependent (non-compile against) jars.
> >
> > I can't find a means in the project.xml or project.properties to specify
the
> > jars to only be used for junit testing.
> >
> > Any ideas?
>
> If you do the following:
>
> <dependency>
>   <groupId>foo</groupId>
>   <artifactId>bar</artifactId>
>   <type>test</type>
>   <version>1.0</version>
> </dependency>
>
> You can make the distinction. Currently a type that corresponds to "jar"
> and "ejb" will be added to the classpath. So by specifying a type other
> than those they will be excluded from the classpath.
>
> So if you give me a few minutes,  I will alter the test plugin to deal
> with test and non-test dependencies. Might as well start now with
> allowing this distinction.
>
> Cary, if I make this change are you going to test it for me?
>
> >
> >
> > Thanks in advance,
> > Cary
> >
> > Learning Maven and liking it.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> -- 
> jvz.
>
> Jason van Zyl
> jason@zenplex.com
> http://tambora.zenplex.org
>
> In short, man creates for himself a new religion of a rational
> and technical order to justify his work and to be justified in it.
>
>   -- Jacques Ellul, The Technological Society
>
>
> ---------------------------------------------------------------------
> 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: Dependency issues for junit tests

Posted by Jason van Zyl <jv...@maven.org>.
On Thu, 2004-01-08 at 14:50, Cary Coulter wrote:
> How can I specify additional dependent jars for junit tests?
> 
> The main application code (non-junit classes) does not need (nor do we want
> the developers to compile against) several lower level application jars
> (stuff we have built wrappers for to isolate them from our code).
> 
> However, in order to run the junit tests, the project needs access to the
> wrapper jars dependencies.  Different projects might need a different list
> of these dependent (non-compile against) jars.
> 
> I can't find a means in the project.xml or project.properties to specify the
> jars to only be used for junit testing.
> 
> Any ideas?

If you do the following:

<dependency>
  <groupId>foo</groupId>
  <artifactId>bar</artifactId>
  <type>test</type>
  <version>1.0</version>
</dependency>

You can make the distinction. Currently a type that corresponds to "jar"
and "ejb" will be added to the classpath. So by specifying a type other
than those they will be excluded from the classpath.

So if you give me a few minutes,  I will alter the test plugin to deal
with test and non-test dependencies. Might as well start now with
allowing this distinction.

Cary, if I make this change are you going to test it for me?

> 
> 
> Thanks in advance,
> Cary
> 
> Learning Maven and liking it.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
-- 
jvz.

Jason van Zyl
jason@zenplex.com
http://tambora.zenplex.org

In short, man creates for himself a new religion of a rational
and technical order to justify his work and to be justified in it.
  
  -- Jacques Ellul, The Technological Society


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