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 16:47:53 GMT
- what does "-debug" say?
- is ${javabin} set?

Jan

> -----Urspr√ľngliche Nachricht-----
> Von: michael sorens [mailto:msorens@myrealbox.com]
> Gesendet am: Freitag, 21. Januar 2005 17:45
> An: Ant Users List
> Betreff: Re: ant access of java constants
> 
> I tried adding this chunk of code:
> <loadproperties 
> srcfile="${javabin}/com/cleancode/data/Diagnostic.class">
>    <filterchain>
>      <classconstants/>
>    </filterchain>
> </loadproperties>
> 
> but received this error:
> 
> C:\usr\ms\devel\cleancode-support\build.xml:100: Unable to 
> load file: java.io.IOException
>          at 
> org.apache.tools.ant.taskdefs.LoadProperties.execute(LoadPrope
> rties.java:225)
>          at 
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
>          at org.apache.tools.ant.Task.perform(Task.java:364)
>          at org.apache.tools.ant.Target.execute(Target.java:341)
>          at org.apache.tools.ant.Target.performTasks(Target.java:369)
>          at 
> org.apache.tools.ant.Project.executeTarget(Project.java:1214)
>          at 
> org.apache.tools.ant.Project.executeTargets(Project.java:1062)
>          . . .
> --- Nested Exception ---
> java.io.IOException
>          at 
> org.apache.tools.ant.filters.ClassConstants.read(ClassConstant
> s.java:136)
>          at 
> org.apache.tools.ant.filters.BaseFilterReader.read(BaseFilterR
> eader.java:86)
>          at java.io.Reader.read(Reader.java:100)
>          at 
> org.apache.tools.ant.util.FileUtils.readFully(FileUtils.java:1126)
>          at 
> org.apache.tools.ant.filters.util.ChainReaderHelper.readFully(
> ChainReaderHelper.java:231)
>          at 
> org.apache.tools.ant.taskdefs.LoadProperties.execute(LoadPrope
> rties.java:202)
>          at 
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
>          . . .
> 
> Any thoughts?
> 
> 
> On Fri, 21 Jan 2005 05:16:27 -0500, Erik Hatcher 
> <erik@ehatchersolutions.com> wrote:
> 
> > And even easier, you can do it with the ClassConstants 
> FilterReader!  :)
> >
> > 	
> http://ant.apache.org/manual/CoreTypes/filterchain.html#classconstants
> >
> >
> > On Jan 21, 2005, at 2:53 AM, Jan.Materne@rzf.fin-nrw.de wrote:
> >
> >> 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
> >>>
> >
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> 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