You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Conelly, Luis (PS, GNF, Contractor)" <Lu...@gnf.com> on 2004/01/12 19:32:38 UTC

task error

Hi all,

	This must be such a simple error, but it seems I can't find the way to fix it.

	I am trying to set the format for <tstamp> task. I just copied from the manual the next snippet of code:

    <target name="initFormatted" description="Initializes Time / Date feature Formatted">
    <tstamp>
      <format property="time.formatted" pattern="MM/dd/yyyy hh:mm aa" unit="hour"/>
    </tstamp>
    </target>

	I need prior target executed to update just the classes recently compiled, from my workdir to my tomcat home, as showed in the snippet below:

    <target name="updateCompiled" description="update *.class files to ${jBanking.classes.tomcat.home}" >
        <copy todir="${jBanking.classes.tomcat.home}">
            <fileset dir="${build}" includes="**/*.class">
                <date datetime="${tbf}" when="after"/>
            </fileset>
        </copy>
    </target>

      I call this target by using <antcall> call from other target, as showed below:

    <target name="updateAll">
        <!-- other stuff here-->
        <antcall target="updateCompiled">
            <param name="tbf" value="${time.formatted}"/>
        </antcall>
        <!-- other stuff here-->
    </target>

	When I try to execute this code, I got following error:

---------
BUILD FAILED
C:\Projects\xxx xxx\jBanking\build.xml:71: Date of ${time.formatted} Cannot be parsed correctly. It should be in MM/DD/YYYY HH:MM AM_PM format.	
---------

	I assumed something was not OK with the format. I changed the format as the error message shows, then the 'initFormatted' target was like:

    <target name="initFormatted" description="Initializes Time / Date feature Formatted">
    <tstamp>
      <format property="time.formatted" pattern="MM/DD/YYYY HH:MM AM_PM" unit="hour"/>
    </tstamp>
    </target>

	But other error came up:

------------

BUILD FAILED
C:\Projects\xxx xxx\jBanking\build.xml:38: java.lang.IllegalArgumentException: Illegal pattern character 'Y'
------------	

	Then, I took a look at http://java.sun.com/j2se/1.4.1/docs/api/java/util/logging/SimpleFormatter.html to check the params used for java.text.SimpleDateFormat class. I found that the params I was using in the first sample of 'initFormatted' were not wrong, but not in the order showed up, neither in the Ant manual, nor in the first error message. 

	Finally, I tried:

    <target name="initFormatted" description="Initializes Time / Date feature Formatted">
    <tstamp>
      <format property="time.formatted" pattern="MM/dd/yyyy hh:mm a" unit="hour"/>
    </tstamp>
    </target>	

	But I got the same error, as shown below:

---------
BUILD FAILED
C:\Projects\xxx xxx\jBanking\build.xml:71: Date of ${time.formatted} Cannot be parsed correctly. It should be in MM/DD/YYYY HH:MM AM_PM format.	
---------

	I used -debug to look what's happening and I got zillions of lines with lots of info, regarding on how the java files were compiled and the properties used / overriden in the <javac> task.

	With -verbose was pretty much the same thing.

	Those are my settings, 

-----------------
Apache Ant version 1.6beta2 compiled on October 16 2003
Buildfile: build.xml
Detected Java version: 1.4 in: C:\DevTools\Java\DevEnv\JBuilder9\jdk1.4\jre
Detected OS: Windows 2000
-----------------	

	Any clue / info / direction will be greatly appreciated. Hope the solution don't involves any upgrade of ant version.

	Thanks for your help and support

	-Regards

	PS. Sorry for the long mail.
	 


_______________________ 
Luis G. Conelly 
Contractor 

Global Nuclear Fuel 
A join venture of GE, Toshiba & Hitachi 
Ph. (+52) 449-910-7800 ext. 7308
Mobile (+52) 449-123-8749
DialComm. *879-7308
Fax (+52)449-910-7801
e-mail Luis.Conelly@gnf.com
SameTime: Luis Conelly/PS/GeneralElectric 
"The information contained in this transmission is non-public, is the confidential, proprietary information of GE Nuclear Energy and / or Global Nuclear Fuel and / or any of its subsidiaries. In addition to any other restrictions that may be imposed by Confidentiality or Non-Disclosure Agreements between GE Nuclear Energy and / or Global Nuclear Fuel and the recipient, may not be disclosed, copied or used for other than its intended purpose without written permission from GE Nuclear Energy and / or Global Nuclear Fuel and / or any of its subsidiaries. 

Re: task error

Posted by Antoine Lévy-Lambert <an...@antbuild.com>.
Conelly, Luis (PS, GNF, Contractor) wrote:

>Hi all,
>
>	This must be such a simple error, but it seems I can't find the way to fix it.
>
>	I am trying to set the format for <tstamp> task. I just copied from the manual the next snippet of code:
>
>    <target name="initFormatted" description="Initializes Time / Date feature Formatted">
>    <tstamp>
>      <format property="time.formatted" pattern="MM/dd/yyyy hh:mm aa" unit="hour"/>
>    </tstamp>
>    </target>
>
>	I need prior target executed to update just the classes recently compiled, from my workdir to my tomcat home, as showed in the snippet below:
>
>    <target name="updateCompiled" description="update *.class files to ${jBanking.classes.tomcat.home}" >
>        <copy todir="${jBanking.classes.tomcat.home}">
>            <fileset dir="${build}" includes="**/*.class">
>                <date datetime="${tbf}" when="after"/>
>            </fileset>
>        </copy>
>    </target>
>
>      I call this target by using <antcall> call from other target, as showed below:
>
>    <target name="updateAll">
>        <!-- other stuff here-->
>        <antcall target="updateCompiled">
>            <param name="tbf" value="${time.formatted}"/>
>        </antcall>
>        <!-- other stuff here-->
>    </target>
>
>	When I try to execute this code, I got following error:
>
>---------
>BUILD FAILED
>C:\Projects\xxx xxx\jBanking\build.xml:71: Date of ${time.formatted} Cannot be parsed correctly. It should be in MM/DD/YYYY HH:MM AM_PM format.	
>---------
>
>	I assumed something was not OK with the format. I changed the format as the error message shows, then the 'initFormatted' target was like:
>
>    <target name="initFormatted" description="Initializes Time / Date feature Formatted">
>    <tstamp>
>      <format property="time.formatted" pattern="MM/DD/YYYY HH:MM AM_PM" unit="hour"/>
>    </tstamp>
>    </target>
>
>	But other error came up:
>
>------------
>
>BUILD FAILED
>C:\Projects\xxx xxx\jBanking\build.xml:38: java.lang.IllegalArgumentException: Illegal pattern character 'Y'
>------------	
>
>	Then, I took a look at http://java.sun.com/j2se/1.4.1/docs/api/java/util/logging/SimpleFormatter.html to check the params used for java.text.SimpleDateFormat class. I found that the params I was using in the first sample of 'initFormatted' were not wrong, but not in the order showed up, neither in the Ant manual, nor in the first error message. 
>
>	Finally, I tried:
>
>    <target name="initFormatted" description="Initializes Time / Date feature Formatted">
>    <tstamp>
>      <format property="time.formatted" pattern="MM/dd/yyyy hh:mm a" unit="hour"/>
>    </tstamp>
>    </target>	
>
>	But I got the same error, as shown below:
>
>---------
>BUILD FAILED
>C:\Projects\xxx xxx\jBanking\build.xml:71: Date of ${time.formatted} Cannot be parsed correctly. It should be in MM/DD/YYYY HH:MM AM_PM format.	
>---------
>
>	I used -debug to look what's happening and I got zillions of lines with lots of info, regarding on how the java files were compiled and the properties used / overriden in the <javac> task.
>
>	With -verbose was pretty much the same thing.
>
>	Those are my settings, 
>
>-----------------
>Apache Ant version 1.6beta2 compiled on October 16 2003
>Buildfile: build.xml
>Detected Java version: 1.4 in: C:\DevTools\Java\DevEnv\JBuilder9\jdk1.4\jre
>Detected OS: Windows 2000
>-----------------	
>
>	Any clue / info / direction will be greatly appreciated. Hope the solution don't involves any upgrade of ant version.
>
>	Thanks for your help and support
>
>	-Regards
>
>	PS. Sorry for the long mail.
>	 
>
>
>_______________________ 
>Luis G. Conelly 
>Contractor 
>
>
>  
>
Hi Luis,

the reference for date formats is : 
http://java.sun.com/j2se/1.4.1/docs/api/java/text/SimpleDateFormat.html

I have tried this :

<project name="timestamp" default="initFormatted">
    <target name="initFormatted" description="Initializes Time / Date 
feature Formatted">
    <tstamp>
      <format property="time.formatted" pattern="MM/dd/yyyy hh:mm a" 
unit="hour"/>
    </tstamp>
    <echo> ${time.formatted} </echo>
    <fileset dir="." id="myfileset">
        <date datetime="${time.formatted}" when="before"/>
    </fileset>
    <pathconvert refid="myfileset" property="myfileset" targetOS="unix"/>
    <echo> ${myfileset} </echo>
    </target>   
</project>

this works for me under ant 1.6.0 (should not be different from 
ant1.6beta2 for this functionality)

Cheers,

Antoine

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


Re: task error

Posted by Stefan Bodewig <bo...@apache.org>.
On Mon, 12 Jan 2004, Luis Conelly <Lu...@gnf.com> wrote:

>     <target name="initFormatted" 
>             description="Initializes Time /Date feature Formatted">
>       <tstamp>
>         <format property="time.formatted" pattern="MM/dd/yyyy hh:mm aa"
>                 unit="hour"/> 
>       </tstamp> 
>     </target>
>
>     <target name="updateAll">
>         <!-- other stuff here-->
>         <antcall target="updateCompiled">
>             <param name="tbf" value="${time.formatted}"/>
>         </antcall>
>         <!-- other stuff here-->
>     </target>

updateAll doesn't depend on the initFormatted target, so the property
time.formatted doesn't get set at all.

Stefan

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