"ant -version" -> build.xml does not exist

I

iliad

hi!

i can use ant with a simple build.xml, but when i want to display the
version via "ant -version", ant does not seem to recognize the
commandline args. it only displays "Buildfile: build.xml does not
exist! Build failed". If there would be a build.xml in the same dir
than it would process this file.
i donn't know what the problem could be, i'm new to ant.

- windows xp
- java 1.5.0.8
- ant 1.6.5

environment variables:
ANT_HOME = C:\apps\java\apache\ant
Path = C:\apps\java\apache\ant\bin
JAVA_HOME = C:\apps\sun\java\1.5.0.8
 
S

Soren Kuula

iliad said:
hi!

i can use ant with a simple build.xml, but when i want to display the
version via "ant -version", ant does not seem to recognize the
commandline args. it only displays "Buildfile: build.xml does not
exist! Build failed". If there would be a build.xml in the same dir
than it would process this file.
i donn't know what the problem could be, i'm new to ant.

Funny. My ant 1.6.5 under Java 1.5.06, but under Linux, does:
[dongfang@skodspand tmp]$ ant -version
Apache Ant version 1.6.5 compiled on June 2 2005
[dongfang@skodspand tmp]$

There is no build.xml in the directory.

Maybe the ant developers have made an error in the order in which things
are done -- build.xml load, and finding out which command to execute (is
the build file needed at all?)

Anyway, unless it were a big practical problem for me, I'd probably just
be satisfied that my version was 1.6.5 ;)

Do you need to do a version check because you are using 1.6.* features?
Does it work with older versions?

Soren
 
I

iliad

hi soren,

i noticed that it works when i add "C:\apps\java\apache\ant" to the
java classpath. it seems that the following environment variables
should be set:

ANT_HOME = C:\apps\java\apache\ant
CLASSPATH = C:\apps\java\apache\ant
Path = C:\apps\java\apache\ant\bin

i think the classpath is not mentioned in the ant manuel..
thanks for your help!


Soren said:
iliad said:
hi!

i can use ant with a simple build.xml, but when i want to display the
version via "ant -version", ant does not seem to recognize the
commandline args. it only displays "Buildfile: build.xml does not
exist! Build failed". If there would be a build.xml in the same dir
than it would process this file.
i donn't know what the problem could be, i'm new to ant.

Funny. My ant 1.6.5 under Java 1.5.06, but under Linux, does:
[dongfang@skodspand tmp]$ ant -version
Apache Ant version 1.6.5 compiled on June 2 2005
[dongfang@skodspand tmp]$

There is no build.xml in the directory.

Maybe the ant developers have made an error in the order in which things
are done -- build.xml load, and finding out which command to execute (is
the build file needed at all?)

Anyway, unless it were a big practical problem for me, I'd probably just
be satisfied that my version was 1.6.5 ;)

Do you need to do a version check because you are using 1.6.* features?
Does it work with older versions?

Soren
 
D

Daniel Dyer

hi soren,

i noticed that it works when i add "C:\apps\java\apache\ant" to the
java classpath. it seems that the following environment variables
should be set:

ANT_HOME = C:\apps\java\apache\ant
CLASSPATH = C:\apps\java\apache\ant
Path = C:\apps\java\apache\ant\bin

i think the classpath is not mentioned in the ant manuel..
thanks for your help!

There is no need to set the CLASSPATH environment variable for Ant (there
is no need to ever set it, it's more trouble than it's worth). I don't
have a CLASSPATH environment variable and Ant works fine for me. Did you
have it set previously with a different value? That may have messed
things up.

Dan.
 
I

iliad

dan,

i'm at least not aware of messing something up;) just extracted the
ant-zip and set the environment variables. maybe i called it once in a
different folder? anyway, ant's shell arguments (-version) work only if
i have the classpath set.
 
D

Daniel Dyer

dan,

i'm at least not aware of messing something up;) just extracted the
ant-zip and set the environment variables. maybe i called it once in a
different folder? anyway, ant's shell arguments (-version) work only if
i have the classpath set.

It seems there is something odd going on.

Does your CLASSPATH variable contain anything when it fails?

Are you using the standard Windows shell?

Are you certain that it is using the version of Ant you have downloaded?
Under bash you can do 'which ant' to find out exactly which command you
are invoking, but I'm not sure that Windows has an equivalent. If I had
to guess at what the problem was I would say that you have another script
on your path called 'ant' or 'ant.bat' that is calling the standard ant
script without passing the command line arguments.

Is it possible that you have another version of Ant somewhere on your
machine (some IDEs will bundle Ant)?

Dan.
 
I

iliad

dan, thanks for your hints!

my problem was that i didn't had the "." in my classpath. so my
classpath is now
"C:\apps\java\junit\junit-4.1.jar;C:\apps\java\junit\;." and ant works
at it should. thanks!
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top