Reputation: 31252
This is what I get after I installed Ant:
ant -v
Apache Ant(TM) version 1.9.4 compiled on April 29 2014
Trying the default build file: build.xml
Buildfile: build.xml does not exist!
Build failed
Debug option: (not clear to me)
ant --execdebug
exec "/Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home/jre/bin/java" -classpath "/Users/sridhar/software_downloads/apache-ant-1.9.4/lib/ant-launcher.jar" -Dant.home="/Users/sridhar/software_downloads/apache-ant-1.9.4" -Dant.library.dir="/Users/sridhar/software_downloads/apache-ant-1.9.4/lib" org.apache.tools.ant.launch.Launcher -cp ""
Buildfile: build.xml does not exist!
Build failed
I have set the environment variable correctly:
echo $ANT_HOME
/Users/software_downloads/apache-ant-1.9.4
echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home
I followed this post:
sudo mkdir /usr/lib/java-1.7.0 /usr/share/java-1.7.0
I still get same error
I am using Mac OS X mavericks and Jdk1.7
Upvotes: 0
Views: 2987
Reputation: 12332
You are in fact running Ant successfully. -v
stands for verbose in this case, but I suspect you were thinking it stood for version. The error message just means you are missing the Ant script file in the current directory, default named build.xml
.
Create a build script named build.xml
. This one just prints the version of Ant. You would need to modify it to do something more interesting.
<project default="print-version">
<target name="print-version">
<echo>${ant.version}</echo>
</target>
</project>
In the same directory as build.xml
, run ant
. You should see something like this printed:
print-version:
[echo] Apache Ant(TM) version 1.8.4 compiled on November 8 2012
BUILD SUCCESSFUL
Note that Ant is a scripting language. You have installed the necessary Ant library JARs, but you still need to create your Ant scripts. A typical Ant script would compile, copy resources, package and JAR your product.
See here for a good tutorial: Hello World with Apache Ant
Upvotes: 2