Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8082907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:16:36+00:00 2026-06-05T17:16:36+00:00

After build, I need to modify an HTML file that points the client to

  • 0

After build, I need to modify an HTML file that points the client to download the new app.

I search for a token; replace it with a link and token:

<replace file="index.html" >

    <!-- this searches for literal text ${MyTOKEN} -->
    <!-- does not "expand" ${MyTOKEN} before searching -->
    <replacetoken>${MyTOKEN}</replacetoken>

    <replacevalue>"some link" <br> ${MyTOKEN}</replacevalue>
</replace>

This code CANNOT be moved into a template build script because the replacetoken and replacevalue tags take the text as literals – they do not expandproperties in my version of ANT.

I would like to use properties to define the "some link" and MyTOKEN values.


Workaround for using properties in "some link" is to use a filterchain and copy the file after the replacement:

<copy file="index.html" tofile="index2.html" >
    <filterchain>
        <!-- this converts the ${xxx} properties into their values -->
        <expandproperties />
    </filterchain>
</copy>

But that works AFTER the replace has been done – so it means I still need to hard-code the MyTOKEN values directly into the build script.

  • I want to define my token outside of my build script, and reference it inside the build script.
  • How do I do that?

Update: Should I create my own replace task using copy, filterreader and filterchain? I don’t really understand that method properly, but it looks like the way.


Update expanding on accepted answer: I was originally using the <replacetoken> & <replacevalue> method because I needed my value to span multiple lines.

By using token & value, I was unable to find a way to make line breaks.

The solution to putting line breaks is to use ${line.separator} as the line break. See docs on the Echo Task.

As an extra, here is a page of some more useful (off topic) ANT properties: Built-in Ant Properties.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T17:16:38+00:00Added an answer on June 5, 2026 at 5:16 pm

    Using the token and value attributes works here. This works for me with Ant 1.7.1:

    build.properties

    token=FOO
    tokval=some ${token}
    

    build.xml

    <project>
      <property file="build.properties" />
      <target name="repl">
        <replace file="test.txt" token="${token}" value="${tokval}" />
      </target>
    </project>
    

    Hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This happens after I hit Build and Go to run my app on my
After following these steps: http://developers.facebook.com/docs/mobile/android/build/ I find that everything goes well, but when I
I need to build Special Java Api to wrap Magento Api. After struggling with
I am working with a Visual Studio project file, and I need to modify
My task is to make Hudson starting a new build after a commit. As
I need to build a sequence of objects that are loaded from an external
I have created SQL Server 2008 Database project using visual studio 2010. after build
I got build error after run in Snow Leopard (MacPort v.1.8.0) sudo port install
For normal (say Windows Forms) C# applications, to execute commands after a successful build
After signing and preparing the blackberry application build very properly, I uploaded the build

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.