[英]unable to run Ant on my mac Os X?
This is what I get after I installed Ant: 这是我安装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 我正在使用Mac OS X特立独行的人和Jdk1.7
You are in fact running Ant successfully. 实际上,您正在成功运行Ant。
-v
stands for verbose in this case, but I suspect you were thinking it stood for version. -v
在这种情况下代表冗长,但我怀疑您认为它代表版本。 The error message just means you are missing the Ant script file in the current directory, default named build.xml
. 该错误消息仅表示您在当前目录(默认名为
build.xml
中缺少Ant脚本文件。
Create a build script named build.xml
. 创建一个名为
build.xml
的构建脚本。 This one just prints the version of Ant. 这只是打印出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
. 在与
build.xml
相同的目录中,运行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. 请注意,Ant是一种脚本语言。 You have installed the necessary Ant library JARs, but you still need to create your Ant scripts.
您已经安装了必要的Ant库JAR,但是仍然需要创建Ant脚本。 A typical Ant script would compile, copy resources, package and JAR your product.
典型的Ant脚本将编译,复制资源,打包并JAR您的产品。
See here for a good tutorial: Hello World with Apache Ant 参见此处以获得良好的教程: Apache Ant的Hello World
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.