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 5986879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:44:08+00:00 2026-05-22T22:44:08+00:00

How can i overwrite some existing property with a newly created properties file? Here

  • 0

How can i overwrite some existing property with a newly created properties file?

Here is the required structure:

initially load Master.properties
generate new.properties


load new.properties and master.properties
run master.xml (ANT script)

The idea is that Master.properties generates some product version which should be replaced by new.properties. However, other properties in Master.properties should be kept the same.

Reading this does not help as i do not know how can i load the new.properties file

EDIT Here is ANT Script:

<project name="nightly_build" default="main" basedir="C:\Work\NightlyBuild">
    <target name="init1">
        <sequential>
                    <property file="C:/Work/NightlyBuild/master.properties"/>
            <exec executable="C:/Work/Searchlatestversion.exe">
                <arg line='"/SASE Lab Tools" "${Product_Tip}/RELEASE_"'/>
            </exec>
            <sleep seconds="10"/>
            <property file="C:/Work/new.properties"/>

        </sequential>
    </target>
    <target name="init" depends="init1">
        <sequential>
            <echo message="The product version is ${Product_Version}"/>
            <exec executable="C:/Work/checksnapshot.exe">
                <arg line='-NightlyBuild ${Product_Version}-AppsMerge' />
            </exec> 
            <sleep seconds="10"/>
            <property file="C:/Work/checksnapshot.properties"/>
            <tstamp>
                <format property="suffix" pattern="yyyy-MM-dd.HHmm"/>
            </tstamp>
        </sequential>
    </target>
    <target name="main" depends="init">
            <echo message="loading properties files.." />
            <echo message="Backing up folder" />
            <move file="C:\NightlyBuild\NightlyBuild" tofile="C:\NightlyBuild\NightlyBuild.${suffix}" failonerror="false" />
                <exec executable="C:/Work/sortfolder.exe">
                    <arg line="6" />
                </exec>
                <exec executable="C:/Work/NightlyBuild/antc.bat">
                </exec> 
    </target>
</project>

in the above script, <exec executable="C:/Work/NightlyBuild/antc.bat"> will run Master.xml ANT script. This Master.xml will load up Master.properties:

<project name="Master ANT Build" default="main" >               
    <taskdef name="CFileEdit" classname="com.ANT_Tasks.CFileEdit"/>
    <!-- ========================================================== -->
    <!-- init: sets global properties                               -->
    <!-- ========================================================== -->
    <target name="init">
        <property environment="env"/>
        <!-- ========================================================== -->
        <!-- Set the timestamp format                   -->
        <!-- ========================================================== -->
        <property file="Master.properties"/>
         ...
</project>
  • 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-05-22T22:44:08+00:00Added an answer on May 22, 2026 at 10:44 pm

    You should be able to resolve this by looking at the order in which you load (or otherwise specify) your property values. You probably don’t need to override property values at all, which something not supported by core Ant.

    Maybe you can split your Master.properties into two files – one loaded before you generate new.properties and one loaded after?

    Maybe you don’t need to generate new.properties at all.

    Could you give some more detail on what you need to do?

    Since you eventually fork a new Ant process (exec antc.bat), does that not start a fresh environment anyway? If it just loads Master.properties, those are the only properties it will have.

    Not sure what your antc.bat does, but it’s pretty unusual to exec Ant from Ant in this way. There are two standard tasks which might be useful – Ant and AntCall.

    OK running on from your later comments…

    Let’s say that instead of doing this:

    <exec executable="antc.bat">
    

    you instead did something like this:

    <ant file="Master.xml" inheritall="false">
       <property name="Product_Version" value="${Product_Version}"/>
    </ant>
    

    I think that is getting towards what you want. You selectively pass specific values that you have obtained by loading new.properties. See the documentation for the Ant task.

    If you still have the problem that you already defined Product_Version before loading new.properties, then I would say get the script you have that produces new.properties to output the version with a different name, e.g. New_Product_Version. Then invoke your master build something like this:

    <ant file="Master.xml" inheritall="false">
       <property name="Product_Version" value="${New_Product_Version}"/>
    </ant>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I attempt to overwrite an existing file, I get a permission denied error.
In install4j, we can set the Overwrite policy for a file If newer, otherwise
NOTE : UPDATED MY QUESTION Some times, we have to overwrite the css file
I created an app to connect to an existing sqlite db, and display some
In some languages you can override the new keyword to control how types are
On Unix, I can either use \r (carriage return) or \b (backspace) to overwrite
I'm trying to find documentation on how I can override a property name in
How can I override the IsValid property? I have a model that's validating as
First some brief background: I have an existing ASP.NET MVC 1 application using Entity
I desperately need some help on this one. I've created a <script> that closely

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.