ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject AW: ant access of java constants
Date Fri, 21 Jan 2005 07:53:45 GMT
You can do that via API calls
- your own task
- <script>
But you have to ensure that the class can be found.

Example:
--------
public class MyClass {
    public static final String TEXT = "MyClass sais: Hello  World";
}

<project>
    <script language="javascript">
        importClass(Packages.MyClass);
        project.setNewProperty("out", MyClass.TEXT);
    </script>
    <echo>OUTPUT: ${out}</echo>
</project>

$ ant -lib .


Jan


> -----Urspr√ľngliche Nachricht-----
> Von: michael sorens [mailto:msorens@myrealbox.com]
> Gesendet am: Freitag, 21. Januar 2005 02:24
> An: user@ant.apache.org
> Betreff: ant access of java constants
> 
> Is it possible to set an ant property to a value that is a 
> static constant from a Java class file?
> Example:
> 
> public class Stuff {
> 	. . .
> 	static final int FOOBAR=42;
> 	. . .
> }
> 
> Access with something like this...?
> 
> <property name="foobar" value=???? Stuff.FOOBAR />
> 
> Or more generally, could one set a property to the value of a 
> static method?
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message