ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scot P. Floess" <flo...@mindspring.com>
Subject Re: Setting final strings at compile time
Date Mon, 10 Dec 2007 18:56:48 GMT
Eric:

You mention "final Java Strings at compile time"...

Are you referring to actual Java as in:
    public static final String FOO = "some text";

If so, you may want to look into the <replace> task...

You could do something as simple as:

public class Main
{
    public static final String FOO = "%PROJECT NAME%";
...
}

<replace file = "Main.java"  token = "%PROJECT NAME%"  value = "Some 
Value"/>

Of course, you probably want to copy off Main.java to a new dir and do 
the replacement there - compiling that copied version of course...




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 -Dproperty=value but could
> I do this at compile time?
> What I want to do is have one target which makes a program called "Java
> Program XYZ - production" and another which is called "Java Program XYZ
> - development".
> Also, it would be useful to somehow get the date and time at which it
> was compiled into the program.
>
> I figured this would be common, hopefully it is.  Perhaps I 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
>
>
>   

-- 
Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-754-4592 (Work)

Chief Architect JPlate   http://sourceforge.net/projects/jplate
Chief Architect JavaPIM  http://sourceforge.net/projects/javapim
QA Engineer OpenQabal    http://openqabal.dev.java.net


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message