ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pritesh Saharey" <pritesh.saha...@wipro.com>
Subject RE: Changing Date format
Date Thu, 30 Nov 2006 12:40:28 GMT

Thanks for quick reply, but when I tried to use the code like this:

//----------------------------------------------
<target name="chg-date">
    <scriptdef name="dateConvert" language="javascript">
        <attribute name="in"/>
        <attribute name="out"/>
        <![CDATA[
            in  = new java.io.File(attributes.get("in"));
            out = new java.io.File(attributes.get("out"));
            fIn  = new java.text.SimpleDateFormat("yyyy/MM/dd");
            fOut = new java.text.SimpleDateFormat("MMM dd, yyyy");
            while(line = in.readLine()) {
		    out.writeln( fOut.format( fIn.parse(line) ));
            }
            in.close(); 
            out.close();
        ]]>
    </scriptdef> 
    <dateConvert in="D:/LFCG/data" out="Datachange"/>
    </target>
//---------------------------------------------- 
When I tried running my build file, it's giving me logging error

//-------------------------------------------------
BUILD FAILED
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
        at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1225)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
        at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.j
ava:40)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: java.lang.NoClassDefFoundError:
org/apache/commons/logging/LogFactory

        at org.apache.bsf.BSFManager.<init>(BSFManager.java:102)
        at
org.apache.tools.ant.util.ScriptRunner.executeScript(ScriptRunner.java:111)
        at
org.apache.tools.ant.taskdefs.optional.script.ScriptDef.executeScript(Script
Def.java:317)
        at
org.apache.tools.ant.taskdefs.optional.script.ScriptDefBase.execute(ScriptDe
fBase.java:47)

//--------------------------------------------------------
Any guess where I am going wrong??

Thanks
Pritesh

-----Original Message-----
From: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de] 
Sent: Thursday, November 30, 2006 2:19 PM
To: user@ant.apache.org
Subject: AW: Changing Date format

Custom task, like (pseudocode)

<scriptdef name="dateConvert" language="javascript">
    <attribute name="in"/>
    <attribute name="out"/>
    <![CDATA[
        in  = new java.io.File(attributes.get("in"));
        out = new java.io.File(attributes.get("out"));
        fIn  = new java.text.SimpleDateFormat("yyyy/MM/dd");
        fOut = new java.text.SimpleDateFormat("MMM dd, yyyy");
        while(line = in.readLine()) {
		out.writeln( fOut.format( fIn.parse(line) ));
        }
        in.close(); 
        out.close();
    ]]>
</scriptdef> 


Jan




>-----Urspr√ľngliche Nachricht-----
>Von: Pritesh Saharey [mailto:pritesh.saharey@wipro.com]
>Gesendet: Donnerstag, 30. November 2006 08:05
>An: 'Ant Users List'
>Betreff: Changing Date format
>
>
>Dear All,
>         I had a file named "data", which contains the date of an 
>indefinite number in the format year/month/day;
>
>The Data file looks like this:
>
>Data
>-----
>1864/06/22
>1854/04/29
>1823/12/07
>:
>:
>:
>
>I want to change the format of this date so that the new "datachnage" 
>file will look something like this:
>
>Datachange
>----------
>(June 22, 1864)
>(April 29, 1854)
>(December 07, 1823)
>:
>:
>:
>
>Can anyone throw an idea on this?
>
>Regards,
>Pritesh
>
>
>
>
>The information contained in this electronic message and any 
>attachments to this message are intended for the exclusive use of the 
>addressee(s) and may contain proprietary, confidential or privileged 
>information. If you are not the intended recipient, you should not 
>disseminate, distribute or copy this e-mail. Please notify the sender 
>immediately and destroy all copies of this message and any attachments.
>
>WARNING: Computer viruses can be transmitted via email. The recipient 
>should check this email and any attachments for the presence of 
>viruses. The company accepts no liability for any damage caused by any 
>virus transmitted by this email.
> 
>www.wipro.com
>
>---------------------------------------------------------------------
>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





The information contained in this electronic message and any attachments to this message are
intended for the exclusive use of the addressee(s) and may contain proprietary, confidential
or privileged information. If you are not the intended recipient, you should not disseminate,
distribute or copy this e-mail. Please notify the sender immediately and destroy all copies
of this message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should check this email
and any attachments for the presence of viruses. The company accepts no liability for any
damage caused by any virus transmitted by this email.
 
www.wipro.com

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


Mime
View raw message