Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 43319 invoked from network); 10 Dec 2007 19:05:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Dec 2007 19:05:55 -0000 Received: (qmail 26693 invoked by uid 500); 10 Dec 2007 19:05:40 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 26491 invoked by uid 500); 10 Dec 2007 19:05:39 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 26477 invoked by uid 99); 10 Dec 2007 19:05:39 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Dec 2007 11:05:39 -0800 X-ASF-Spam-Status: No, hits=-1.0 required=10.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [194.138.160.6] (HELO goliath.siemens.com) (194.138.160.6) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Dec 2007 19:05:17 +0000 Received: from mail2.sbs.siemens.com (mail2.sbs.siemens.com [129.73.68.7]) by goliath.siemens.com (8.12.11.20060614/8.12.11) with ESMTP id lBAJ5jr9022389 for ; Mon, 10 Dec 2007 14:05:46 -0500 (EST) Received: from ORLA183A.ww007.siemens.net (orla183a.orla.siemens.com [209.243.192.211]) by mail2.sbs.siemens.com (8.12.11.20060308/8.12.11) with ESMTP id lBAJ5G6e019875 for ; Mon, 10 Dec 2007 14:05:17 -0500 Received: from USORL02P702.ww007.siemens.net ([209.243.214.215]) by ORLA183A.ww007.siemens.net with Microsoft SMTPSVC(6.0.3790.3959); Mon, 10 Dec 2007 14:05:16 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: Setting final strings at compile time Date: Mon, 10 Dec 2007 14:05:15 -0500 Message-ID: In-Reply-To: <475D8BF0.10604@mindspring.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Setting final strings at compile time Thread-Index: Acg7Xo5grGh317c6SXq4Pp7ljpHQQQAACRgg References: <475D8BF0.10604@mindspring.com> From: "Frederich, Eric P21322" To: "Ant Users List" X-OriginalArrivalTime: 10 Dec 2007 19:05:16.0259 (UTC) FILETIME=[99754330:01C83B5F] X-Virus-Checked: Checked by ClamAV on apache.org Thanks for the reply and a possible solution but this seems more like a hack. Yeah, right now I have something like Public static final String programName =3D "Java Program XYZ"; I'd like to be able to make one where that string is "Java Program XYZ - Development Version" automagically using ant. If the javac command could set properties the way the java command does it would be nice. If this isn't the case I guess I'll be stuck with a "hack" like this. Just seems to be a pain to explicitly copy the original to a tmp directory, do the replacement on the file, compile it and then copy the original file back. > -----Original Message----- > From: Scot P. Floess >=20 > Eric: >=20 > You mention "final Java Strings at compile time"... >=20 > Are you referring to actual Java as in: > public static final String FOO =3D "some text"; >=20 > If so, you may want to look into the task... >=20 > You could do something as simple as: >=20 > public class Main > { > public static final String FOO =3D "%PROJECT NAME%"; > ... > } >=20 > Value"/> >=20 > Of course, you probably want to copy off Main.java to a new=20 > dir and do=20 > the replacement there - compiling that copied version of course... >=20 >=20 >=20 >=20 > Frederich, Eric P21322 wrote: > > Hello, > > > > Is there an easy way to set final Java Strings at compile time? > > I know you can set properties at runtime with=20 > -Dproperty=3Dvalue but could > > I do this at compile time? > > What I want to do is have one target which makes a program=20 > called "Java > > Program XYZ - production" and another which is called "Java=20 > Program XYZ > > - development". > > Also, it would be useful to somehow get the date and time=20 > at which it > > was compiled into the program. > > > > I figured this would be common, hopefully it is. Perhaps I=20 > just don't > > know the right words to search on Google. > > > > Thanks in advance, > > ~Eric --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org