ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Weintraub <>
Subject Re: relative path
Date Thu, 11 Jun 2009 12:59:40 GMT
Is this Ant "library" build file included with the <import> task?

If this is the case, the imported tasks will behave as if they're in the
original build file. From the Ant Manual in the <import> task:

I*mported files are treated as they are present in the main buildfile.*

Otherwise, if you used <ant> or <subant>, you will need to pass the base
directory as a parameter:

<ant target="sometarget"
    <param name="calling.basedir" value="${basedir}/>

Now, in the "library" build.xml file, you'd use ${calling.basedir} instead
of ${basedir}.

I recommend using <import> for common tasks. I've had quite a bit of success
defining my main targets ("clean", "compile", "package", "test") in an
<import> build.xml, and having the developers use that. It makes creating
the project's build.xml much easier and there is less code repetition.

On Thu, Jun 11, 2009 at 2:47 AM, divyanshu singh

> i have one ant build file which kind of acts as a library file
> other build files use its ant task how can i adjust the base directory of
> library build file to automatically set path to the file which calls its
> ant
> task
> like if i set property of path to ./hello
> then for library file also the path should remain ./hello relative to the
> calling file

David Weintraub

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