用brew安装了maven,maven使用时,发现从maven的官方中央仓库更新依赖库速度太慢,所以想更改maven配置文件,添加国内的maven仓库镜像。但是,却不知道brew把maven装到哪里了。so,开始捉迷藏~
brew把maven藏到哪里了呢?
既然是brew把maven藏起来的,那么首先想到,brew是不是知道呢?我们就直接问问brew。
在bash终端中
$ brew
Example usage:
brew search [TEXT|/REGEX/]
brew (info|home|options) [FORMULA...]
brew install FORMULA...
brew update
brew upgrade [FORMULA...]
brew uninstall FORMULA...
brew list [FORMULA...]
Troubleshooting:
brew config
brew doctor
brew install -vd FORMULA
Developers:
brew create [URL [--no-fetch]]
brew edit [FORMULA...]
http://docs.brew.sh/Formula-Cookbook.html
Further help:
man brew
brew help [COMMAND]
brew home
大概看了下,下面这两个是最有可能提供线索的
brew search [TEXT|/REGEX/]
brew (info|home|options) [FORMULA...]
info提供了一条路径线索
$ brew info maven
maven: stable 3.3.9
Java-based project management
https://maven.apache.org/
Conflicts with: mvnvm
/usr/local/Cellar/maven/3.3.9 (96 files, 9.6M) *
Built from source on 2017-01-21 at 15:32:59
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/maven.rb
==> Requirements
Required: java ✔
看看这个路径是maven的藏身之处吗?
$ ls /usr/local/Cellar/maven/3.3.9
INSTALL_RECEIPT.json NOTICE bin/
LICENSE README.txt libexec/
大概是,为啥说大概,因为没看到conf/setting.xml文件啊!4个文件和2个文件夹,setting.xml会在2个文件夹里吗?
$ ls bin/
mvn* mvn.cmd* mvnDebug* mvnDebug.cmd* mvnyjp*
bin/下没有,虽然我也不知道为啥这些文件最后会带个*号,但明显不是我要找的。
$ ls libexec/
bin/ boot/ conf/ lib/
啊哈,看我发现了什么?conf/ 那么setting.xml会在conf下吗?
$ ls libexec/conf
logging/ settings.xml toolchains.xml
终于找到你啦,setting.xml君!
实际情况是:我在“/usr/local/Cellar/maven/3.3.9”目录下只查看了bin文件夹,libexec文件夹被我忽视了,然后我废了好长时间在网上进行查找,但都没有找到相关的信息,一度绝望,然后决定从maven官网下载maven手动安装!
前往maven主页
$ brew home maven
进到install页面(表问我为啥不先去Download页面下载maven =_=,我也不知道,可能那一刻被大能控制了!),然后就看到Maven home!!!
总结:brew和maven都知道maven被藏到哪里了!