Running ant from Ruby

F

femol

--_=__=_XaM3_.1098466674.2A.850302.42.11700.52.42.007.718111719
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

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 se=
en to get that to work...

I am new to Ruby so I can=B4t tell what I am doing wrong...

I have tried system('ant') but it didnt't work...Then I tried system('jav=
a ant') but it gives a NoClassDefFoundError...probably missing some libra=
ry...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 s=
ome light on the subject?

Thank you very much for your time.

Felipe
--_=__=_XaM3_.1098466674.2A.850302.42.11700.52.42.007.718111719--
 
J

Jim Menard

femol said:
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
 
E

Edwin Eyan Moragas

'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)
 
M

Michael DeHaan

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?
 
J

Joel VanderWerf

Michael said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,241
Latest member
Lisa1997

Latest Threads

Top