You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Sachin Shah <Sa...@kaleconsultants.com> on 2001/08/31 07:36:14 UTC

Extracting Version

Hi,

I have an application developed i want to incorporate the version and build
information within the application such that everytime i release the
application i can get the exact version and build information. does any one
has idea how to implement this. Is this possible using ant. if yes can
anyone has code to do the same.

Thanks in advance
Sachin 


Re: Extracting Version

Posted by Peter Donald <do...@apache.org>.
On Fri, 31 Aug 2001 15:36, Sachin Shah wrote:
> Hi,
>
> I have an application developed i want to incorporate the version and build
> information within the application such that everytime i release the
> application i can get the exact version and build information. does any one
> has idea how to implement this. Is this possible using ant. if yes can
> anyone has code to do the same.

The way I do it is to place version information in the Jar according to 
package standard and then extract it via java.lang.Package object or 
alternatively (and much more simpler) is to define some constants somewhere. 
I usually do something like

interface Constants
{
  String VERSION = "@@VERSION@@";
  String DATE = "@@DATE@@";
}

and then replace the constants during build process. See Ants build process 
for examples of that.

-- 
Cheers,

Pete

--------------------------------------------------
you've made a dangerous leap right over common 
sense, like some kind of metaphysical Evil Knievel
--------------------------------------------------


Re: Extracting Version

Posted by Erik Hatcher <er...@earthlink.net>.
Ironically I just a second ago provided an example of this very thing on a
related topic.     Look back at the message with the subject "wildcards in
replace task".

Our build process involves using the <propertyfile> task to build a property
file at run-time with all of the build details, and the build version gets
set as the CVS tag used to build the deployment WAR file.   The versioning
scheme may need some refactoring, but in general we'll at least know the tag
used so that a build can be replicated precisely.

    Erik


----- Original Message -----
From: "Sachin Shah" <Sa...@kaleconsultants.com>
To: <an...@jakarta.apache.org>
Sent: Thursday, August 30, 2001 10:36 PM
Subject: Extracting Version


> Hi,
>
> I have an application developed i want to incorporate the version and
build
> information within the application such that everytime i release the
> application i can get the exact version and build information. does any
one
> has idea how to implement this. Is this possible using ant. if yes can
> anyone has code to do the same.
>
> Thanks in advance
> Sachin
>