You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by ippi <he...@yahoo.com> on 2005/01/19 20:09:34 UTC

ignoring CLASSPATH inside a junit task

Hi,

I was wondering if there is a way to 
get a <junit> task which contains a
<classpath> to ignore the CLASSPATH 
enviromental variable altogether. I've
tried using the fork and newenvironment
attributes in addition to the env,
sysproperty and jvmarg nested elements
but nothing seems to prevent the
CLASSPATH from being searched after
the <classpath> fails.

Yup, I don't want to have to hear
myself say "well it works on my
machine" ever again!

Thanks



		
__________________________________ 
Do you Yahoo!? 
Meet the all-new My Yahoo! - Try it today! 
http://my.yahoo.com 
 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: ignoring CLASSPATH inside a junit task

Posted by ippi <he...@yahoo.com>.
Oops - spoke too soon! [red-faced grin]

Without going into the embarressing details, my
previous assertion that setting 
includeantruntime="no" made everything work 
perfectly is not at all correct. Rather, ant
just prints out the following exception for 
each TestCase loaded:

    [junit] Exception in thread "main"
java.lang.NoClassDefFoundError:
org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner

This doesn't change it I put junit.jar in the
$CLASSPATH or in $ANT_HOME/lib.

Currently if I set build.sysclasspath="ignore" the 
following still leads to the $CLASSPATH being 
searched:        
<junit printsummary="yes"
       haltonfailure="no"
       fork="yes">
...
</junit>

My current environment is a bit too complicated to 
be used to debug this issue so I'm going to take 
a while to set up a clean-room enviroment where I
can isolate the problem a little better.

--- ippi <he...@yahoo.com> wrote:

> Stefan, you're a Legend - the following works 
> perfectly (with ant 1.6.2):
> 
> <junit printsummary="yes"
>        haltonfailure="no"
>        fork="yes"
>        newenvironment="yes"
>        includeantruntime="no>
> ...
> </junit>
> 
> I was missing the includeantruntime="no". 
> 
> Thanks again.
> 
> 
> --- Stefan Bodewig <bo...@apache.org> wrote:
> 
> > On Fri, 21 Jan 2005, ippi <he...@yahoo.com>
> > wrote:
> > 
> > > Thanks for the reply. I had actually tried
> setting
> > > the build.sysclasspath but I quickly gave up on
> it
> > > when it failed to work for me. When I got your 
> > > message I did some more extensive testing and
> now
> > > I realise that the build.sysclasspath property
> > only 
> > > effects the <junit> tasks that don't fork a new
> > JVM.
> > 
> > I don't think this is true.  Which version of Ant
> > are you using?
> > At least if you set newenvironment at the same
> time,
> > your initial
> > CLASSPATH setting shouldn't be there.  Make sure
> > includeantruntime is
> > false as well.
> > 
> > Stefan
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > user-unsubscribe@ant.apache.org
> > For additional commands, e-mail:
> > user-help@ant.apache.org
> > 
> > 
> 
> 
> 
> 		
> __________________________________ 
> Do you Yahoo!? 
> All your favorites on one personal page � Try My
> Yahoo!
> http://my.yahoo.com 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 



		
__________________________________ 
Do you Yahoo!? 
Take Yahoo! Mail with you! Get it on your mobile phone. 
http://mobile.yahoo.com/maildemo 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: ignoring CLASSPATH inside a junit task

Posted by ippi <he...@yahoo.com>.
Stefan, you're a Legend - the following works 
perfectly (with ant 1.6.2):

<junit printsummary="yes"
       haltonfailure="no"
       fork="yes"
       newenvironment="yes"
       includeantruntime="no>
...
</junit>

I was missing the includeantruntime="no". 

Thanks again.


--- Stefan Bodewig <bo...@apache.org> wrote:

> On Fri, 21 Jan 2005, ippi <he...@yahoo.com>
> wrote:
> 
> > Thanks for the reply. I had actually tried setting
> > the build.sysclasspath but I quickly gave up on it
> > when it failed to work for me. When I got your 
> > message I did some more extensive testing and now
> > I realise that the build.sysclasspath property
> only 
> > effects the <junit> tasks that don't fork a new
> JVM.
> 
> I don't think this is true.  Which version of Ant
> are you using?
> At least if you set newenvironment at the same time,
> your initial
> CLASSPATH setting shouldn't be there.  Make sure
> includeantruntime is
> false as well.
> 
> Stefan
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 



		
__________________________________ 
Do you Yahoo!? 
All your favorites on one personal page � Try My Yahoo!
http://my.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: ignoring CLASSPATH inside a junit task

Posted by Stefan Bodewig <bo...@apache.org>.
On Fri, 21 Jan 2005, ippi <he...@yahoo.com> wrote:

> Thanks for the reply. I had actually tried setting
> the build.sysclasspath but I quickly gave up on it
> when it failed to work for me. When I got your 
> message I did some more extensive testing and now
> I realise that the build.sysclasspath property only 
> effects the <junit> tasks that don't fork a new JVM.

I don't think this is true.  Which version of Ant are you using?
At least if you set newenvironment at the same time, your initial
CLASSPATH setting shouldn't be there.  Make sure includeantruntime is
false as well.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: ignoring CLASSPATH inside a junit task

Posted by ippi <he...@yahoo.com>.
Hi Stefan

Thanks for the reply. I had actually tried setting
the build.sysclasspath but I quickly gave up on it
when it failed to work for me. When I got your 
message I did some more extensive testing and now
I realise that the build.sysclasspath property only 
effects the <junit> tasks that don't fork a new JVM.

It's certainly a solution that I can work with but if
there was a way to achieve the same result with 
fork="yes" then I would very much like to know of it.


--- Stefan Bodewig <bo...@apache.org> wrote:

> On Wed, 19 Jan 2005, ippi <he...@yahoo.com>
> wrote:
> 
> > I was wondering if there is a way to 
> > get a <junit> task which contains a
> > <classpath> to ignore the CLASSPATH 
> > enviromental variable altogether.
> 
> If you can get the rest of your build file to work
> without CLASSPATH
> as well, then you can set build.sysclasspath to
> ignore.
> 




		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Easier than ever with enhanced search. Learn more.
http://info.mail.yahoo.com/mail_250

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: ignoring CLASSPATH inside a junit task

Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 19 Jan 2005, ippi <he...@yahoo.com> wrote:

> I was wondering if there is a way to 
> get a <junit> task which contains a
> <classpath> to ignore the CLASSPATH 
> enviromental variable altogether.

If you can get the rest of your build file to work without CLASSPATH
as well, then you can set build.sysclasspath to ignore.

<http://ant.apache.org/manual/sysclasspath.html>

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org