ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Dawson <>
Subject configuration builds ...or... <filter filtersfile> behavior not c onsistent with <property file>
Date Thu, 14 Dec 2000 23:03:37 GMT
Aside from the inconsistent naming (should be <filter file="foo"...> to be
consistent with <property file="foo...">), I've noticed that properties
don't do conversions on property values that reference other properties.
before I give details, I'll explain how we use filters & why we'd want this.

We like to do "configuration" builds. We set up development, test, and
production build configurations, and sometimes more than that, for example a
dev cluster build vs. a standard dev build. Anyway, we use a "config"
property that we provide a defualt value for, but can override on the
command line, e.g. "ant install -Dconfig=test".

Now, we basically want the same set of config properties to be available as
filters, since occasionally the same value is needed in both. For example,
the name of the server is needed when computing the installdir used by ANT,
and also within the start script.  Here's where we want recursive
expansion... when the value references another key.

This is how we set up our properties:

  <property name="config" value="dev" /> <!-- default config -->
  <property file="" />
  <property file="build-${config}.properties" />
  <property file="" />
  <property file="" />

the file contains the following lines


and my file contains


This all works fine with properties... if I do an <echo>, install-dir
correctly reports C:/devtools/weblogic-510/intranet-dev (three

But if I do a <filter> and <copy> using the following filter commands... 

    <filter filtersfile="" />
    <filter filtersfile="build-${config}.properties" />
    <filter filtersfile="" />

it replaces 

  set SERVER_NAME=@server-name@


  set SERVER_NAME=intranet-${config}

instead of 

  set SERVER_NAME=intranet-dev

Now, the only way to get this to work correctly is that I'm lucky that we
use the same file for filters as well as properties, so I can do this...

    <filter filtersfile="" />
    <filter filtersfile="build-${config}.properties" />
    <filter filtersfile="" />
    <filter token="config" value="${config}" />
    <filter token="server-name" value="${server-name}" />

Only by overriding the tokens with the properties can I get things to work.

Does anybody else do config builds like this?  Am I doing the right thing? I
would think that recursive substitution in filters would be an obvious

Thanks for any feedback...


View raw message