ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "JWM" <techst...@malcolms.com>
Subject RE: Generating rotating file name?
Date Thu, 02 Mar 2006 23:58:33 GMT
Jan,

Haven't actually used scripts in ant before.  But definitely seems like the
way to go.  I added the bsf jar and the js jar (decided javascript was the
easiest). But I'm apparently still missing some other lib.  I get the
following exception.  What jar file do I still need to add?  (Or am I
somehow mismatched on versions?

Thx.

Apache Ant version 1.6.5 compiled on June 2 2005
Buildfile: build.xml
Detected Java version: 1.5 in: C:\jdk1.5.0_01\jre
Detected OS: Windows 2003
parsing buildfile C:\backup\test\build.xml with URI =
file:///C:/backup/test/build.xml
Project base dir set to: D:\Backup\zip
Build sequence for target(s) `all' is [all]
Complete build sequence is [all, ]

all:

BUILD FAILED
java.lang.NoSuchMethodError:
org.mozilla.javascript.Context.getDebuggableEngine()Lorg/mozilla/javascript/
debug/DebuggableEngine;
        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.NoSuchMethodError:
org.mozilla.javascript.Context.getDebuggableEngine()Lorg/mozilla/javascript/
debug/DebuggableEngine;
        at org.apache.bsf.engines.javascript.JavaScriptEngine.eval(Unknown
Source)
        at org.apache.bsf.util.BSFEngineImpl.exec(Unknown Source)
        at org.apache.bsf.BSFManager$6.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.apache.bsf.BSFManager.exec(Unknown Source)
        at
org.apache.tools.ant.util.ScriptRunner.executeScript(ScriptRunner.java:128)
        at
org.apache.tools.ant.taskdefs.optional.Script.execute(Script.java:60)
        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.executeSortedTargets(Project.java:1216)
        ... 7 more

-----Original Message-----
From: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de] 
Sent: Thursday, March 02, 2006 1:08 AM
To: user@ant.apache.org
Subject: AW: Generating rotating file name?

You could try playing with AntContribs <math> task, but I think in your case
the easiest is to implement your own task using <script>.

pseudo-code:
  <script>
     nowMS  = System.getTimeMillies
     nowDay = nowMS / 1000 / 60 / 60 / 24
     number = nowDay % 4
     project.setNewProperty("nr", number)
  </>
  <echo file="file.${nr}"> hello </echo>


Jan

>-----Ursprüngliche Nachricht-----
>Von: JWM [mailto:techstuff@malcolms.com] 
>Gesendet: Donnerstag, 2. März 2006 07:43
>An: 'Ant Users List'
>Betreff: Generating rotating file name?
>
>I need to generate a 4-cycle rotating file name based on the 
>day (first day = "file.1", second day = "file.2, .. fifth day 
>= "file.1" (repeating).
>
>Basically I need to generate a string that is "Julian date mod 
>4" to append to my base filename.  <Tstamp> with the 
>DateFormatter gives me a lot of options.  But I don't see this one.
>
>Is there a way to get a numeric value (i.e. Julian date from 
>tstamp) and do a 'mod' operation on it to get a new property?
>
>Is there a better way to get a rotating string that increments 
>each day, then repeats after a specified max?
>
>Thx
>
>
>
>---------------------------------------------------------------------
>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
View raw message