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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:25:44+00:00 2026-05-26T23:25:44+00:00

I have 2 vars that I need. first is DSTAMP with yyyy-MM-dd formatting and

  • 0

I have 2 vars that I need. first is DSTAMP with yyyy-MM-dd formatting and the other one is the buildNumber from my .build file.
In a simple structure like this :

<project .....>

   <property ....>

   <target ....>

   <target .....>

</project>

My question is, how can I set the ${build.number} and DSTAMP like a property? I’ve tried to do this :

<project .....>

   <tstamp>
   <format property="DSTAMP" pattern="yyyy-MM-dd" />
</tstamp>

   <buildnumber file=".build"/>

   <property ....>

   <target ....>

   <target .....>

</project>

I thought i could then access it with ${build.number} and ${DSTAMP} anywhere in my ant script but it says unexpected token. How can i store these properties to access them anywhere?

Ant version 1.5.4.
It seems to accept it in Ant 1.6+ but I would rather not change my library just for this.

  • 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-26T23:25:44+00:00Added an answer on May 26, 2026 at 11:25 pm

    Ok I used another solution as buildNumber task doesn’t behave like I want :

    <project name="MyProject" default="all" basedir=".">
    
     <taskdef resource="net/sf/antcontrib/antlib.xml"/>
    
     <tstamp>
        <format property="DSTAMP" pattern="yyyy-MM-dd" />
        <format property="TODAY" pattern="yyyy-MM-dd HH:MM:SS" />
     </tstamp>
     <property file=".build"/>
     <property name="buildNum" value="${build.number}"/>
    
     [... some tasks ...]
    
     <target name="incrementVersion">
            <echo>Building version ${build.number} success</echo>
            <propertyfile file="./.build" comment="Build Number">
                    <entry key="build.number" type="int" operation="+" default="1000" pattern="0000"/>
            </propertyfile>
     </target>
    
    <target name="all" depends="some,other,target,incrementVersion"/>
    </project>
    

    This way I’m 100% certain that it will only increment at the end of my tasks and only if it succeed. Only minor problem here, you have to run incrementVersion once so it can initialize the buildNumber parameter. I could do some if exist control but since my file will never be deleted I don’t care. You have to use Ant 1.6+ and Ant Contrib. I use Ant 1.8.2 and Ant Contrib 1.0b3
    thanks all.

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

Sidebar

Related Questions

We have a need to access kernel global vars in net/ipv4/af_inet.c that are not
I have an array that I need to unpack. So, from something like var
I have two arrays. The first one contains an id, username, and password from
I have this class that contains vars for db connection; Imports Microsoft.VisualBasic Imports System.Data.SqlClient
I have a file that defines constant variables, like this: define_vars.php <? define(something,value); define(something1,value);
I have an external file with some vars to require in my php class
I have a simple Android.mk file: LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) $(shell ($(LOCAL_PATH)/echo_test.sh))
I have 2 classes, main and extended. I need to use main vars in
I have a solution but it is one that I know is not the
I have some php variables that I need to spit out in a template

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.