ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Cohen" <Ste...@ignitesports.com>
Subject RE: ant-Junit question
Date Sat, 26 Jan 2002 13:09:56 GMT
<adding ant-dev to this thread>
In thinking this over, it occurs to me that this might be a bug.  But
I'm not sure.  For sure, it feels counterintuitive to me that the junit
task would need a dir="${basedir}" statement.  Shouldn't you be able to
assume that that was true?  Are there any cases where you would not want
to assume that (especially when fork="yes")?

If there are such cases, then I could agree with the current
functionality.  There'd be no way to do it, and the current
functionality is flexible enough to allow both cases.  But I just can't
imagine such a case.

A case where 
1) One build.xml calls another in a different directory with the "dir"
attribute set
2) The called build.xml has a <junit> task
3) The calling build.xml invokes that <junit> task in the called
build.xml
4) The call of that junit task is set with fork=yes to run in a separate
jvm 
and yet 
5) You want that separate jvm to run in the directory of the calling
build.xml  if the called build.xml is invoked from a calling build.xml
but in its own directory if invoked standalone.

Is this a case where we're providing unneeded flexibility at the price
of making the process counterintuitive?  Or is there a case for this
that I'm not seeing.





-----Original Message-----
From:	Steve Cohen
Sent:	Fri 1/25/2002 5:17 PM
To:	Ant Users List
Cc:	
Subject:	RE: ant-Junit question
Ah, the light dawns.  Even with "fork" set to yes, you STILL have to
have a dir="${basedir}"
in the <junit> task.  Just setting "fork" to yes won't change the dir.

-----Original Message-----
From: Steve Cohen 
Sent: Friday, January 25, 2002 3:54 PM
To: Ant Users List
Subject: RE: ant-Junit question


Well, this just keeps getting stranger all the time.

The ant script is invoked with dir set to the directory in which the
"called" build.xml is located.  junit is invoked within this "called"
script with fork set to "yes".  No dir is defined for junit, which, I
would think would cause it default to using basedir which should be the
directory specified by the "dir" attribute in the ant call.  And yet, it
doesn't work that way.  It acts as though the current directory is the
current directory of the "calling" build.xml.



-----Original Message-----
From: Diane Holt [mailto:holtdl@yahoo.com]
Sent: Friday, January 25, 2002 3:43 PM
To: Ant Users List
Subject: RE: ant-Junit question


See the 'dir' attribute in the "Parameters" table of the Ant task
description in the doc.

Diane

--- Steve Cohen <SteveC@ignitesports.com> wrote:
> It's not so much that I want to read a file (although, eventually, a
> file gets read), but my test is testing a method that takes a File
> object as a parameter.  And this file is located on a relative path to
> the where the script is run.
> 
> -----Original Message-----
> From: KC Baltz [mailto:KBaltz@responsenetworks.com]
> Sent: Friday, January 25, 2002 3:02 PM
> To: Ant Users List
> Subject: Re: ant-Junit question
> 
> 
> Why do your tests need to know the current directory?  If it's because
> you 
> want to read in a file, try using Class.getResource() to read it from
a 
> location on the classpath.
> 
> K.C.
> 
> At 12:19 PM 1/25/02, you wrote:
> >I have a build.xml file that includes junit targets.  These targets
> >produce tests that succeed when the build.xml file is run
> >from the the directory in which build.xml is located.  However, when
I
> >run the same build.xml through an ant task from another
> >build.xml in another directory, the tests fail.  The tests fail
because
> >they think the current directory is the directory from which ant was
> >initially launched.  How can I modify my <ant> task in the calling
file
> >to let it know that the current directory should be that of the
> launched
> >file?
> >
> >-----------------------------------------------------------------
> >Steve Cohen
> >Sr. Software Engineer
> >Ignite Sports, Inc.
> >4410 N. Ravenswood
> >Chicago IL 60640
> >(773)-293-4342
> >stevec@ignitesports.com
> 
> --
> To unsubscribe, e-mail:
> <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:ant-user-help@jakarta.apache.org>
> 
> 
> --
> To unsubscribe, e-mail:  
> <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:ant-user-help@jakarta.apache.org>
> 


=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions! 
http://auctions.yahoo.com

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


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


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





Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message