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"
dest="${targets}">
<patternset>
<include name="META-INF/application.xml"/>
</patternset>
</unjar>
<echo message="Extracted the application.xml file"/>
<replace file="${targets}/META-INF/application.xml"
token=">context-root<TURBO_Online-*"
value=">context-root<TUBO_Online-${turbo.id}@${turbo.suffix}gt;/context-root<"/>
<replace file="${targets}/META-INF/application.xml"
token=">context-root<TURBO_Admin-*"
value=">context-root<TURBO_Admin-${turbo.id}@${turbo.suffix}>/context-root<"/>
<echo message="Replacements completed"/>
<jar destfile="${targets}/Turbo.ear"
includesfile="${targets}/META-INF/application.xml"
update="true"/>
<echo message="EAR file updated with user specific information!"/>
</target>
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!