Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Tools / November 2003

Tip: Looking for answers? Try searching our database.

Ant: Filter does not do proper replacement on copy task

Thread view: 
Ronald Fischer - 26 Nov 2003 12:47 GMT
My problems are related to the Ant tasks filter and copy. Here is a
distilled form of the problem:

File build.properties:

  user=smith
  home.dir=/home/${user}
  PROJ=${home.dir}/project

File build.xml (excerpt):

  <target name="mkpar">
     <property file="build.properties" />
     <echo message="home.dir=${home.dir}" />
     <filter filtersfile="build.properties" />
     <copy file="par.xml.template" tofile="par.xml" filtering="true" />
  </target>

File par.xml.template (excerpt):
   <dir>@PROJ@</dir>

Running target mkpar first outputs

  home.dir=/home/smith

but the resulting file par.xml contains

  <dir>${home.dir}/project</dir>

and not, as I would have expected,

  <dir>/home/smith/project</dir>

It is as if the properties would not be substituted properly when
the property file is used as a filter.

Is this a bug in Ant or a feature? Can someone suggest an easy workaround?

Ronald
Stefan Bodewig - 27 Nov 2003 09:01 GMT
> It is as if the properties would not be substituted properly when
> the property file is used as a filter.
>
> Is this a bug in Ant or a feature? Can someone suggest an easy workaround?

It is a known (missing) feature in Ant, see
<http://issues.apache.org/bugzilla/show_bug.cgi?id=8972>

Stefan
Stefan Bodewig - 27 Nov 2003 09:09 GMT
> It is as if the properties would not be substituted properly when
> the property file is used as a filter.
>
> Is this a bug in Ant or a feature? Can someone suggest an easy workaround?

It is a known (missing) feature in Ant, see
<http://issues.apache.org/bugzilla/show_bug.cgi?id=8972>

Stefan


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.