Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Replace Problem

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm running the below text search-n-replace to convert some directive includes to runtime includes. It says successful but doesn't actually convert the file! Any ideas?


<project name="replaceIncludes" basedir="." default="replace">
<target name="replace">
<replace file="myfile.jsp">

<replacevalue>%@include file="/file.jsp" %</replacevalue>
<replacetoken>jsp:include page="/file.jsp" /</replacetoken>
</replace>
</target>
</project>

C:\tierWork\uiprototype_512\WebContent>ant -verbose
Apache Ant version 1.5.4 compiled on August 12 2003
Buildfile: build.xml
Detected Java version: 1.3 in: C:\Program Files\IBM\WebSphere Studio\runtimes\base_v5\java\jre
Detected OS: Windows XP
parsing buildfile build.xml with URI = file:C:/work/build.xml
Project base dir set to: C:\work
Build sequence for target `replace' is [replace]
Complete build sequence is [replace]

replace:
[replace] Replacing in C:\work\myfile.jsp: jsp:include page="/file.j
sp" / --> %@include file="/file.jsp" %

BUILD SUCCESSFUL
 
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looks like you've got your token and value reversed.

It's trying to replace the jsp:include String with the @include String, and that worked for me.

my "myfile.jsp" - orig
<replacevalue>%@include file="/file.jsp" %</replacevalue>
<replacetoken>jsp:include page="/file.jsp" /</replacetoken>
</replace>

my "myfile.jsp" - after replace
<replacevalue>%@include file="/file.jsp" %</replacevalue>
<replacetoken>%@include file="/file.jsp" %</replacetoken>
</replace>
[ April 05, 2005: Message edited by: Carol Enderlin ]
 
Steven Martin
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Carol. I thought it was finding them and was a bit confused.
 
permaculture is a more symbiotic relationship with nature so I can be even lazier. Read tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic