Great response. You hit every nail directly on the head, including the ones I didn't mention. Your recommended placement of the build file, and thus the base directory is dead on. I will move it.
Obviously you are correct that I misunderstood <dirname>. I will try to RTFM a bit more closely in the future. Thanks, Donald Holliday -----Original Message----- From: Matt Benson [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 08, 2004 3:07 PM To: Ant Users List Subject: Re: Don't how ant interacts with directories Q/A: 1. The value of the "basedir" attribute of <project> was D:\Local\AntExps\directoryExp\build. The value of ${user.dir} was D:\Local\AntExps\directoryExp\build. So how can the value of ${pwd} be D:\Local\AntExps\directoryExp which is one level up from the directory where I ran ant? A: You have misunderstood <dirname>. <dirname> finds the parent directory of the entity passed it, regardless of whether that entity is a directory itself. 2. ${source.dir} was supposed to be ${user.dir}../source, which should have evaluated to D:\Local\AntExps\directoryExp\source, but instead it evaluated to D:\Local\AntExps\directoryExp\build.. (note the two trailing dots). Why? A: The reason you are seeing ".." trailing what you thought you would see is that you have omitted a necessary slash before "..". However, this would remain part of the filename using the value attribute. In general you will see surely-no-worse-and-probably-better results from <property>'s "location" attribute instead of "value" for directory names and the like. Also, answer this: do you want basedir and user.dir tied together? basedir is the current directory OF THE BUILDFILE while user.dir is the USER's current directory. So what happens when someone invokes this buildfile from another directory? I'm not going to take the time to figure it out but I'll bet it's not what you intend. Most builds don't need to use user.dir for anything. 3. ${build.dir} was supposed to be the same as ${user.dir} and evaluate to D:\Local\AntExps\directoryExp\build, but instead evaluated to D:\Local\AntExps\directoryExp which is one level up from ${user.dir} in the directory hierarchy. How can this happen? A: See #1 4. ${lib.dir} was supposed to evaluate to D:\Local\AntExps\directoryExp\build\lib, but instead evaluated to D:\Local\AntExps\directoryExp\build, why? A: See #1 One more thing: it appears you have a project base directory, then you want your Ant buildfile to live in a build directory. It is more common usage to store the buildfile in the base directory, hence the property name "basedir". In this case it means you would avoid some of the ".." headache. For that matter you could have specified basedir=".." on your project tag and probably been better off. You CAN do it the way you're doing it, but I think it's not a very common thing to do, unless there is a realy reason you can't put the buildfile in the base directory. Also, when your build directory contains nothing but artifacts of the build process, it's very easy to write a "clean" target: <delete dir="${build.dir}" /> HTH, Matt __________________________________ Do you Yahoo!? Yahoo! Mail - Find what you need with new enhanced search. http://info.mail.yahoo.com/mail_250 --------------------------------------------------------------------- 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]