Ivan Ivanov wrote:
Fermin,Thank you. I found that out by reading through the apache site and doing some more googling.
you should check[1] to see the exact versions of the
third party libraries.
Turns out that i needed 3 additional jars of which the Rhino one was unusal.
But, i'v got it running.
I use successfully such scripts with Eclipse, but I do
not used the ant distribution bundled with Eclipse.
Instead, I have "standalone" ant installation on my
disk and I configured Eclipse to use it. I point Ant
Home from Window->Preferences->Ant->Runtime and I then
add the third party jars from $HOME/.ant/lib in the
classpath.
Thx again,
Fermin DCG
HTH Ivan
[1]http://ant.apache.org/manual/install.html#librarydependencies
--- Fermin Da Costa <[EMAIL PROTECTED]> wrote:
[1]http://marc.theaimsgroup.com/?l=ant-user&m=110987001620450&w=2Thx a lot, much appreciated. I have not been able to run it yet though because running it from eclipse i keep on getting errors. 1st was bsf related, fixed that. Than i got a rhino error, fixed that by stuffing the js.jar in there. Now i get a NoSuchMethod error. Haven't done this one yet.
Well, i'm guessing it should work so i'll just continue.
Cheers,
Fermin DCG
On Apr 5, 2005 10:56 AM, Ivan Ivanov
<[EMAIL PROTECTED]> wrote:
Hello, Fermin,language="javascript">
You can do 2. with javascript:
<project>
<scriptdef name="countFiles"
c);<attribute name="dir"/> <attribute name="extension"/> <attribute name="property"/> <![CDATA[ importClass(java.io.File); importClass(java.io.FileFilter); f = new File(attributes.get("dir")); e = attributes.get("extension");
filter = new FileFilter() { accept: function(file) { s = file.getName(); if (s.endsWith(e)) { return true; } } };
c = f.listFiles(filter).length;
project.setNewProperty(attributes.get("property"),
does]]> </scriptdef>
<countFiles dir="${basedir}" property="xmlfiles"
extension=".xml"/>
<echo>$${xmlfiles} is ${xmlfiles}</echo>
<countFiles dir="${basedir}" property="txtfiles"
extension=".txt"/>
<echo>$${txtfiles} is ${txtfiles}</echo>
<condition property="prop">
<equals arg1="${txtfiles}" arg2="2"/>
</condition>
<fail unless="prop" message="txt files count
likenot match"/> </project>
In fact, I often need to extract information about
files and I thought to do a "lib" of <scriptdef>s
the one above to improve reusability. However, Iwrote
an ordinary Ant task that does the job, because itis
easier for me to deploy (plus I am not very goodat
javascript). You can see this task at [1].
HTH Ivan
------------------------------------------------------------------------ Fermin Da Costa Gomez <[EMAIL PROTECTED]>(getting
wrote:
Hi,
What would be the best way to do the following:
1. Going into a directory (this is ok)
2. Counting the number of files of type x
out offiles is ok, *counting* is an
issue)
3. Depending on the count do something (break
the target)
Items 2. and 3. are bugging me somewhat (esp the counting bit in 2). Does anybody have a suggestion as to how i can accomplish this?
tia,
Fermin DCG
---------------------------------------------------------------------Join the fun.__________________________________To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Yahoo! Messenger
Show us what our next emoticon should look like.
http://www.advision.webevents.yahoo.com/emoticontest
---------------------------------------------------------------------To unsubscribe, e-mail:[EMAIL PROTECTED]
For additional commands, e-mail:[EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
__________________________________ Do you Yahoo!? Yahoo! Sports - Sign up for Fantasy Baseball. http://baseball.fantasysports.yahoo.com/
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
