我没有设置ANT_HOME,所以我想找到ant的主目录所在的位置。我正在使用我的OSX安装默认安装的ant版本。
答案 0 :(得分:65)
按照以下说明查找任何包裹的位置:
whereis ant (replace 'ant' with whatever you're looking for)
在我的机器上,报告:
/usr/bin/ant
所以,我这样做:
ls -l /usr/bin/ant
在我的机器上报告:
lrwxr-xr-x 1 root wheel 22 Nov 30 17:09 /usr/bin/ant -> /usr/share/ant/bin/ant
所以,我这样做:
ls -l /usr/share/ant
并获得:
lrwxr-xr-x 1 root wheel 14 Nov 30 17:09 /usr/share/ant -> java/ant-1.8.1
从此可以推测,蚂蚁安装在/usr/share/ant/java/ant-1.8.1
答案 1 :(得分:24)
如果你运行ant -diagnostics,它应该告诉你ant.home在哪里
$ant -diagnostics
-------------------------------------------
ANT PROPERTIES
-------------------------------------------
ant.version: Apache Ant(TM) version 1.9.2 compiled on July 8 2013
ant.java.version: 1.6
ant.core.lib: /opt/local/share/java/apache-ant/lib/ant.jar
ant.home: /opt/local/share/java/apache-ant
答案 2 :(得分:0)
尝试查看/ usr / bin文件夹..它应该告诉你它的安装位置。
答案 3 :(得分:0)
我在整个系统中根本没有ANT
,但我使用NetBeans 8.1或8.2。
第1步:安装NetBeans 8.2
第2步:从NetBeans 8.2应用ant也可以轻松完成
$ "/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/bin/ant" -diagnostics
------- Ant diagnostics report -------
Apache Ant(TM) version 1.9.7 compiled on April 9 2016
-------------------------------------------
Implementation Version
-------------------------------------------
core tasks : 1.9.7 in file:/Applications/NetBeans/NetBeans%208.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant.jar
-------------------------------------------
ANT PROPERTIES
-------------------------------------------
ant.version: Apache Ant(TM) version 1.9.7 compiled on April 9 2016
ant.java.version: 1.8
Is this the Apache Harmony VM? no
Is this the Kaffe VM? no
Is this gij/gcj? no
ant.core.lib: /Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant.jar
ant.home: /Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant
-------------------------------------------
ANT_HOME/lib jar listing
-------------------------------------------
ant.home: /Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant
ant-antlr.jar (11563 bytes)
ant-apache-bcel.jar (15077 bytes)
ant-apache-bsf.jar (9827 bytes)
ant-apache-log4j.jar (8676 bytes)
ant-apache-oro.jar (9805 bytes)
ant-apache-regexp.jar (9671 bytes)
ant-apache-resolver.jar (9748 bytes)
ant-apache-xalan2.jar (8197 bytes)
ant-commons-logging.jar (9791 bytes)
ant-commons-net.jar (90789 bytes)
ant-jai.jar (28321 bytes)
ant-javamail.jar (13778 bytes)
ant-jdepend.jar (13826 bytes)
ant-jmf.jar (12386 bytes)
ant-jsch.jar (48991 bytes)
ant-junit.jar (117485 bytes)
ant-junit4.jar (13196 bytes)
ant-launcher.jar (18334 bytes)
ant-netrexx.jar (16279 bytes)
ant-swing.jar (13274 bytes)
ant-testutil.jar (27034 bytes)
ant.jar (2027962 bytes)
-------------------------------------------
USER_HOME/.ant/lib jar listing
-------------------------------------------
user.home: /Users/sun
No such directory.
-------------------------------------------
Tasks availability
-------------------------------------------
sshexec : Missing dependency com.jcraft.jsch.Logger
scp : Missing dependency com.jcraft.jsch.Logger
sshsession : Missing dependency com.jcraft.jsch.Logger
jdepend : Missing dependency jdepend.xmlui.JDepend
A task being missing/unavailable should only matter if you are trying to use it
-------------------------------------------
org.apache.env.Which diagnostics
-------------------------------------------
Not available.
Download it at http://xml.apache.org/commons/
-------------------------------------------
XML Parser information
-------------------------------------------
XML Parser : com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl
XML Parser Location: unknown
Namespace-aware parser : com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser
Namespace-aware parser Location: unknown
-------------------------------------------
XSLT Processor information
-------------------------------------------
XSLT Processor : com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl
XSLT Processor Location: unknown
-------------------------------------------
System properties
-------------------------------------------
java.runtime.name : Java(TM) SE Runtime Environment
sun.boot.library.path : /Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre/lib
java.vm.version : 25.31-b07
ant.library.dir : /Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib
user.country.format : BE
gopherProxySet : false
java.vm.vendor : Oracle Corporation
java.vendor.url : http://java.oracle.com/
path.separator : :
java.vm.name : Java HotSpot(TM) 64-Bit Server VM
file.encoding.pkg : sun.io
user.country : US
sun.java.launcher : SUN_STANDARD
sun.os.patch.level : unknown
java.vm.specification.name : Java Virtual Machine Specification
user.dir : /Users/sun/Desktop/android/android-webrtc-master
java.runtime.version : 1.8.0_31-b13
java.awt.graphicsenv : sun.awt.CGraphicsEnvironment
java.endorsed.dirs : /Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre/lib/endorsed
os.arch : x86_64
java.io.tmpdir : /var/folders/zq/zqbl2b1x43g6kq5bxmgx39880000gn/T/
line.separator :
java.vm.specification.vendor : Oracle Corporation
os.name : Mac OS X
ant.home : /Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant
sun.jnu.encoding : UTF-8
java.library.path : /Users/sun/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
java.specification.name : Java Platform API Specification
java.class.version : 52.0
sun.management.compiler : HotSpot 64-Bit Tiered Compilers
os.version : 10.11.6
http.nonProxyHosts : local|*.local|169.254/16|*.169.254/16
user.home : /Users/sun
user.timezone : Europe/Brussels
java.awt.printerjob : sun.lwawt.macosx.CPrinterJob
java.specification.version : 1.8
file.encoding : UTF-8
user.name : sun
java.class.path : /Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-launcher.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-antlr.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-apache-bcel.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-apache-bsf.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-apache-log4j.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-apache-oro.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-apache-regexp.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-apache-resolver.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-apache-xalan2.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-commons-logging.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-commons-net.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-jai.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-javamail.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-jdepend.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-jmf.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-jsch.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-junit.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-junit4.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-launcher.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-netrexx.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-swing.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-testutil.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/lib/tools.jar
java.vm.specification.version : 1.8
sun.arch.data.model : 64
java.home : /Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre
sun.java.command : org.apache.tools.ant.launch.Launcher -cp -diagnostics
java.specification.vendor : Oracle Corporation
user.language : en
awt.toolkit : sun.lwawt.macosx.LWCToolkit
java.vm.info : mixed mode
java.version : 1.8.0_31
java.ext.dirs : /Users/sun/Library/Java/Extensions:/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre/lib/ext:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
sun.boot.class.path : /Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre/lib/sunrsasign.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre/classes
java.vendor : Oracle Corporation
file.separator : /
java.vendor.url.bug : http://bugreport.sun.com/bugreport/
sun.cpu.endian : little
sun.io.unicode.encoding : UnicodeBig
socksNonProxyHosts : local|*.local|169.254/16|*.169.254/16
ftp.nonProxyHosts : local|*.local|169.254/16|*.169.254/16
sun.cpu.isalist :
-------------------------------------------
Temp dir
-------------------------------------------
Temp dir is /var/folders/zq/zqbl2b1x43g6kq5bxmgx39880000gn/T/
Temp dir is writeable
Temp dir alignment with system clock is -6 ms
-------------------------------------------
Locale information
-------------------------------------------
Timezone Central European Time offset=3600000
-------------------------------------------
Proxy information
-------------------------------------------
http.nonProxyHosts = "local|*.local|169.254/16|*.169.254/16"
ftp.nonProxyHosts = "local|*.local|169.254/16|*.169.254/16"
Java1.5+ proxy settings:
Direct connection