On Sun, Aug 17, 2008 at 9:18 PM, Francisco Tolmasky <[EMAIL PROTECTED]> wrote: > I have a common.xml file that I import in all my build.xml throughout my > project (subdirectories included). One of the tasks defined in this > common.xml has to reference a file in a java task, as so: > > <macrodef name = "my-tasl"> > > <element name = "arguments"/> > > <sequential> > <java classname = "blah..Main" > > <classpath> > <pathelement location = "../Jars/thejar.jar" /> > <pathelement location = "." /> > </classpath> > > <arguments/> > </java> > </sequential> > </macrodef> > > Unfortunately, this only works from certain directories, since the > pathelement location is relative. Is there any way to make a relative file > path from the location of the common.xml file itself?
There is a magic property associated with each imported build file which contains the name of the build file. This is ant.file.NAME_OF_PROJECT_OF_BUILD_FILE. This gets set if the build file has a name attribute and this name is unique in the set of imported build files. One can use the <dirname> task to get the directory of the build file. For example: <project name="common"> <dirname property="common.dir" file="${ant.file.common}"/> </project> Peter > > --------------------------------------------------------------------- > 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]