ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominique Devienne" <>
Subject RE: AW: parsing ant build scripts from unusual sources
Date Fri, 15 Oct 2004 14:49:36 GMT
> From: Robert Dockins []
> > Until you've got that working, don't boast too quickly ;-) --DD
> Fair enough.  What I *do* have working, is loading a build script from
> database text field, and running the build in a base directory that is
> determined by other information in the database record.  The builds I
> running are pretty simple at the moment, so I wouldn't call it a
> comprehensive test, but I haven't encountered problems yet.

Just try to run any build that imports another basically.

But for a more concrete example, consider what I'm doing here:
jarfile.xml is a build file designed to be imported, and that
expects to import common.xml (yet another build file) from the
same directory jarfile.xml is in. Neither jarfile.xml or
common.xml need to know where they are, they just need to be
in the same directory together.

It's only the importing build file that needs to know where to
import jarfile.xml from, usually through a property.

<project name="jarfile" default="build">
  <!-- Import common.xml from the same directory we're in -->
  <dirname property="config.dir" file="${ant.file.jarfile}" />
  <import file="${config.dir}/common.xml" />

Or jarfile.xml could load a .properties file using
<property file="${config.dir}/" />.

In both these cases, ant.file.<> must be set,
and it currently must be a File, because it's used in <import>
which works with files only, or with <property>, or with any
other task that manipulate files.

Using files relative another file is a very very common technique
not just in Ant. You need to be able to resolve these relative
files to locate them. It's trivial with File, and would be with
URL too, but for arbitrary non-URL location like a DB blob you
Need yet another custom mechanism. I'm not saying it can be done,
it's just not as simple any more.

So basically your change is already not backward compatible with
what I'm doing in Ant 1.6.2, if I wanted to put my importable
build 'files' in your DB.

That may be OK, since I'd not be using it. All builds I write
are relative to the main build.xml, and now also relative to
different 'islands' of imported build files. --DD

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message