Fermin, you should check[1] to see the exact versions of the third party libraries. 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.
HTH Ivan [1]http://ant.apache.org/manual/install.html#librarydependencies --- Fermin Da Costa <[EMAIL PROTECTED]> wrote: > Thx 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, > > You can do 2. with javascript: > > <project> > > <scriptdef name="countFiles" > language="javascript"> > > <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"), > c); > > ]]> > > </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 > does > > not match"/> > > </project> > > > > In fact, I often need to extract information about > > files and I thought to do a "lib" of <scriptdef>s > like > > the one above to improve reusability. However, I > wrote > > an ordinary Ant task that does the job, because it > is > > easier for me to deploy (plus I am not very good > at > > javascript). You can see this task at [1]. > > > > HTH > > Ivan > > > > > [1]http://marc.theaimsgroup.com/?l=ant-user&m=110987001620450&w=2 > > > > --- Fermin Da Costa Gomez <[EMAIL PROTECTED]> > > 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 > (getting > > > files is ok, *counting* is an > > > issue) > > > 3. Depending on the count do something (break > out of > > > 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 > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: > > > [EMAIL PROTECTED] > > > For additional commands, e-mail: > > > [EMAIL PROTECTED] > > > > > > > > > > __________________________________ > > Yahoo! Messenger > > Show us what our next emoticon should look like. > Join the fun. > > > 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]
