ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From M Damon Hill <>
Subject Token attribute of the <replace> task
Date Wed, 25 Sep 2002 20:10:23 GMT

Easy question.
Using Ant 1.5.1Alpha, and I am using the <replace> task to update a particular file.
What I want to accomplish is search the given file for a specified token, replace it, and
then use that modified file to update a jar file.
Here is the problem, the given token that I want to replace in the file, can change its value
from build to build (I am working around a bug in IBM XMLConfig that doesn't perserve attributes
when reimporting from a file into an EAR file for deployment onto WebSphere). 
So, here is the target I have:
<target name="replace_cr" depends="init">
     <echo message="Modifying the context root in the ear file"/>
     <unjar src="${targets}/Turbo.ear"
            <include name="META-INF/application.xml"/>
     <echo message="Extracted the application.xml file"/>
     <replace file="${targets}/META-INF/application.xml"
     <replace file="${targets}/META-INF/application.xml"
    <echo message="Replacements completed"/>
    <jar destfile="${targets}/Turbo.ear"
    <echo message="EAR file updated with user specific information!"/>

As, you can see, I am trying to match a "pattern" in the token attribute of the replace. However,
obviously, this can't be done. So, does anyone have an EASY way to perform this replace? I
hope so because it appears it should be easliy accomplished.
Thanks in advance.
M Damon Hill

Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message