[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Running ant from Ruby

Felipe Malta de Oliveira

10/22/2004 5:38:00 PM

Hello!

I am crafting a script to automate some bat files I have.One of it steps consists of running ant (the Java build tool from Apache), but I can't seen to get that to work...

I am new to Ruby so I can´t tell what I am doing wrong...

I have tried system('ant') but it didnt't work...Then I tried system('java ant') but it gives a NoClassDefFoundError...probably missing some library...I tried something like
system("java -cp c:/apache-ant-1.6.1/lib ant") and system("java ant -lib c:/apache-ant-1.6.1/lib") but it didn't work also...Can anybody give me some light on the subject?

Thank you very much for your time.

Felipe
5 Answers

Jim Menard

10/22/2004 5:48:00 PM

0

femol wrote:
> Hello!
>
> I am crafting a script to automate some bat files I have.One of it steps consists of running ant (the Java build tool from Apache), but I can't seen to get that to work...
>
> I am new to Ruby so I can´t tell what I am doing wrong...
>
> I have tried system('ant') but it didnt't work...Then I tried system('java ant') but it gives a NoClassDefFoundError...probably missing some library...I tried something like
> system("java -cp c:/apache-ant-1.6.1/lib ant") and system("java ant -lib c:/apache-ant-1.6.1/lib") but it didn't work also...Can anybody give me some light on the subject?

If your current path doesn't include Ant, then you will have to specify the
full path to the Ant executable. Try

system("c:/apache-ant-1.6.1/bin/ant")


Jim
--
Jim Menard, jimm@io.com, http://www.io...



Edwin Eyan Moragas

10/22/2004 6:12:00 PM

0

> 'java ant'

this invocation asks java to run a class called ant.


>"java -cp c:/apache-ant-1.6.1/lib ant"

ask java to look into c:/apache-ant-1.6.1/lib for a class called ant

>"java ant -lib c:/apache-ant-1.6.1/lib")

java doesn't have -lib switch.


you'll probably need to supply the full path of ant to run in (ant
probably not in your PATH)

--
edwin eyan moragas

ha... a... k... tu!


Michael DeHaan

10/22/2004 6:25:00 PM

0

OT, but after having implemented most of a build system in Ant (and
the hard parts in Perl), if I had to do it all over again, I'd do it
all in Ruby/Perl except for the java specific steps (Ant has a much
faster way to compile java projects, since it uses internal java API's
rather than invoking javac on a per-directory basis). Ant is kind of
annoying though when it comes to conditionals, copying,
datastructures, etc -- antcontrib helps some, but not a lot.

Has anyone used Rake for any project ... have any comments?


On Sat, 23 Oct 2004 03:11:45 +0900, Edwin Eyan Moragas <haaktu@gmail.com> wrote:
> > 'java ant'
>
> this invocation asks java to run a class called ant.
>
>
> >"java -cp c:/apache-ant-1.6.1/lib ant"
>
> ask java to look into c:/apache-ant-1.6.1/lib for a class called ant
>
> >"java ant -lib c:/apache-ant-1.6.1/lib")
>
> java doesn't have -lib switch.
>
> you'll probably need to supply the full path of ant to run in (ant
> probably not in your PATH)
>
> --
> edwin eyan moragas
>
> ha... a... k... tu!
>
>


Joel VanderWerf

10/22/2004 7:44:00 PM

0

Michael DeHaan wrote:
> Has anyone used Rake for any project ... have any comments?

Yup, it's great. I just had to write a plain old makefile today for the
first time in a long while... cringe! But I've never used Ant, so can't
compare.


Felipe Malta de Oliveira

10/22/2004 8:45:00 PM

0

That did the trick!
Thank you both of you!

Felipe

----- Original Message -----
From: "Edwin Eyan Moragas" <haaktu@gmail.com>
To: "ruby-talk ML" <ruby-talk@ruby-lang.org>
Sent: Friday, October 22, 2004 4:11 PM
Subject: Re: Running ant from Ruby


> > 'java ant'
>
> this invocation asks java to run a class called ant.
>
>
> >"java -cp c:/apache-ant-1.6.1/lib ant"
>
> ask java to look into c:/apache-ant-1.6.1/lib for a class called ant
>
> >"java ant -lib c:/apache-ant-1.6.1/lib")
>
> java doesn't have -lib switch.
>
>
> you'll probably need to supply the full path of ant to run in (ant
> probably not in your PATH)
>
> --
> edwin eyan moragas
>
> ha... a... k... tu!
>
>