Mac Apache Ant version 1.8.2 instead of 1.9.6

2019-09-06 18:46发布

I've downloaded the last apache ant version on my Mac but the version seems the old one. Any idea?

myMac:~ mauri$ brew install ant
==> Downloading https://homebrew.bintray.com/bottles/ant-1.9.7.el_capitan.bottle.tar.gz
######################################################################## 100,0%
==> Pouring ant-1.9.7.el_capitan.bottle.tar.gz
                

标签: apache ant
2条回答
相关推荐>>
2楼-- · 2019-09-06 19:07

I realized after relooking at the post, that you tried to install ant, it has downloaded ant 1.9.7 version and extraction seemed to be /usr/local/Cellar/ant/1.9.7.

Or you may use the downloaded directory which is /Users/mauri/Downloads/apache-ant-1.9.6

So, all you need to do is to set the environment variables to the right installation path.

Run the following commands on the terminal.

export ANT_HOME=/Users/mauri/Downloads/apache-ant-1.9.6
export CLASSPATH=$ANT_HOME/lib:$CLASSPATH
export PATH=$ANT_HOME/bin:$PATH

Now ant -v should give right result.

Note that the above changes are only for the command session. If you want to apply it permanently, then update the same in your ~/.bash_profile file.

UPDATE:
If the is continue to persist(i.e., referring to older version of ant), it is possible to have softlink to older version. Try to remove that.

查看更多
对你真心纯属浪费
3楼-- · 2019-09-06 19:23

I'm still trying to the reason behind that, but The Ant wrapper script sources some files from /etc if present, so the global installation may leak into your setup regardless. I guess the key is

core tasks  : 1.8.2 in

file:/Library/Java/Extensions/selenium-html-runner-3.0.1.jar" - whatever has put Selenium there, it takes precedence. I want to thank Stefan Bodewig from Apache ANT for this great insight

myMac:~ mauri$ cd /Library/Java/Extensions
myMac:Extensions mauri$ l
total 30536
-rw-r--r--@ 1 root  wheel    15M  4 Dez 12:12 selenium-html-runner-3.0.1.jar
myMac:Extensions mauri$ mv selenium-html-runner-3.0.1.jar ~/
myMac:Extensions mauri$ which ant
/Users/mauri/Downloads/apache-ant-1.9.6/bin/ant
myMac:Extensions mauri$ ant -version
Apache Ant(TM) version 1.9.6 compiled on June 29 2015
查看更多
登录 后发表回答