Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
How can I capture a file 's date to a property?

How can I capture a file 's date to a property?

2007-07-24       - By Dale Anson
Reply:     1     2     3     4     5     6     7     8     9     10  

Hi Charles,

There seems to be an issue with the antelope.taskdef file for a few
tasks.  Try using the antlib.xml instead.  The example below works fine
for me using the current AntelopeTasks_3.4.2.jar from
http://antelope.tigris.org.  I tested this on both Ant 1.6.5 and 1.7.0.

<project name="fileutil_test" basedir="." default="test">

   <taskdef resource="ise/antelope/tasks/antlib.xml"/>

   <target name="test">
       <property name="ant.jar" value="${ant.library.dir}/ant.jar"/>
       <fileutil file="${ant.jar}" property="ant_date">
           <lastmodified format="yyyy-MM-dd"/>
       </fileutil>
       <echo>timestamp on ant.jar is ${ant_date}</echo>
   </target>
</project>

I did notice that on your date format, I think you wanted MM rather than mm.

Hope this helps,

Dale


cknell@(protected) wrote:
> There are a number of problems with the example task:
>
> <fileutil file="foobar.txt" property="moddate">
>    <lastmodified format="...">
>  </fileutils>
>
> - The opening and closing tag names do not match ("fileutil" vs. "fileutils").
> - The <lastmodified> tag is not closed.
>
> Even after correcting for these, I get an error message from ant when I run
the target:
> -----------------------------------------------------------------------------
-------------
> <taskdef resource="ise/antelope/tasks/antelope.taskdefs"/>
>
> <target name="test">
>   <fileutil file="build.xml" property="date.last.modified">
>     <lastmodified format="yyyy-mm-dd" />
>   </fileutil>
>   <echo>${date.last.modified}</echo>
> </target>
>
> ts.xml:6: No public execute() in class ise.antelope.tasks.typedefs.file
.FileLength
> -----------------------------------------------------------------------------
-------------
>
> I have dowloaded and installed AntelopeTasks_3.4.2.jar in the lib directory
of my
> %ANT__HOME% directory.
>
> Can anyone offer a useful analysis of the error message and suggest a fix?
>
> Thanks.
>  

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)


©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.