I have the same problem for both Ant 1.6.2 and 1.6.3, hope someone can help me out. I 1) downloaded the ant zip file (binary distributions) 2) unzipped it to "c:\ant" 3) cd to "c:\ant\bin" 4) type "ant -version"
I got error message below: Buildfile: build.xml does not exist! Build failed
It seems the command line just don't want to take any argument after "ant". Non matter what argument that I put after the "ant" (eg, "ant -help", "ant -diagnostics"), it always displays "Buildfile: build.xml does not exist!". If I put the build.xml on "c:\ant\bin", it runs just fine... Anyone can help??
The OS of my machine is Win2k with service pack 4. thanks.
Alex Belisle Turcot
Ranch Hand
Joined: Apr 26, 2005
Posts: 516
posted
0
Hi,
Is it possible that you did not specify the '-' before the keyword
when you launch ant, it will look for your build script (build.xml by default) where you define your build strategy : clean, compile,test, createJar, javadoc...
First, you should define your environment variables to point to ant, and while you're at it, java, path and classpath :
SET ANT_HOME=utils\ant SET JAVA_HOME=utils\jdk1.4.2 SET PATH=%JAVA_HOME%\bin;%ANT_HOME%\BIN;%PATH% SET CLASSPATH=%JAVA_HOME%\lib;.;%CLASSPATH%
Now you can launch ant from wherever you are by typing "ant compile". Typing this will go through the build.xml you wrote and execute the target "compile". Your build.xml should be in the current directory when you launch ant.
If you want, you can specify another filename for your buildscript :
Hope this helps, Alex [ May 05, 2005: Message edited by: Alex Turcot ]
dave chan
Greenhorn
Joined: May 04, 2005
Posts: 6
posted
0
Hi,
First of all thanks for reply. Actually, I already set all the system path as well as JAVA_HOME/ANT_HOME. I ran the "echo" command and confirmed they were corrected.
I am sure I include the "-" with the command "ant -version" that I typed. As I state, it just ignores the second argument that I type on the command line. It doesn't matter if I type "ant -version" or "ant -help", it always return the error message "Buildfile: build.xml does not exist!". If I create a sample "build.xml", everything run just fine.
Your you don't have an "ANT.BAT" file in your path covering up the %ANT_HOME$\bin\ant program? I had no problems with Ant 1.5 or 1.6.2.
Customer surveys are for companies who didn't pay proper attention to begin with.
Carol Enderlin
drifter
Ranch Hand
Joined: Oct 10, 2000
Posts: 1348
posted
0
Now I'm not sure what you've done. Your original steps are not what the Ant manual - installation instructions say to do. Since you insist everything is correct and don't show us the output how are we to help? We can point to instructions and troubleshooting information.
Also, we highly recommend that you run Ant with an empty CLASSPATH. If any other version of Ant can be loaded from the CLASSPATH, many types of errors may happen because of incompatible classes being loaded.
See the FAQ for some examples, but many other problems are a result of an old version of Ant on your system as well.
dave chan
Greenhorn
Joined: May 04, 2005
Posts: 6
posted
0
Hi All,
I comment out the first line of the ant.bat and dump the result of the command "ant -version" as below. I really don't know what happen here. I try to install ANT on my friend's pc and everything's cool. Any suggestion?
============================================================= C:\temp>REM @echo off
C:\temp>REM Copyright 2001,2004-2005 The Apache Software Foundation
C:\temp>REM
C:\temp>REM Licensed under the Apache License, Version 2.0 (the "License");
C:\temp>REM you may not use this file except in compliance with the License.
C:\temp>REM You may obtain a copy of the License at
thanks for your suggestion. It seems the string/value of the classpath is too long on my machine. I remove some of the value and then add "%JAVA_HOME%\bin" to the classpath, it runs fine now.
Carol Enderlin
drifter
Ranch Hand
Joined: Oct 10, 2000
Posts: 1348
posted
0
There are a variety of things that can go wrong with ant when your classpath is set in your environment. I unset mine with 1.6.x and set up the necessary classpaths in the build.xml. Assuming you were going to have your classpath set you shouldn't need %JAVA_HOME%\bin included, that's not a place where classes live.
Also, we highly recommend that you run Ant with an empty CLASSPATH. If any other version of Ant can be loaded from the CLASSPATH, many types of errors may happen because of incompatible classes being loaded.
dave chan
Greenhorn
Joined: May 04, 2005
Posts: 6
posted
0
so what should I do with my classpath?
I remove the "%JAVA_HOME\bin" and run the command "ant -version", it complains the missing of the "build.xml" file. I, however, run the command "ant -version -noclasspath", it displays the ant version information correctly. thanks.
Scroll down to the bottom of that page, to the references section to see example use of a "named" classpath in the javac task. [ May 16, 2005: Message edited by: Carol Enderlin ]
Roseanne Zhang
Ranch Hand
Joined: Nov 14, 2000
Posts: 1953
posted
0
Dave Chan Here is an example for set your classpath
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.