我已经使用
卸载了maven brew uninstall maven
并尝试使用
重新安装它 brew install maven30
但是我收到了这个错误
brew install maven30
Error: No available formula with the name "maven30"
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
git -C "$(brew --repo homebrew/core)" fetch --unshallow
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
==> Searching local taps...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: curl is not executable
然而,当我使用brew install maven
时,它也被下载并安装了
brew install maven
==> Downloading https://www.apache.org/dyn/closer.cgi?path=maven/maven-3/3.5.2/b
Already downloaded: /Users/amar/Library/Caches/Homebrew/maven-3.5.2.tar.gz
/usr/local/Cellar/maven/3.5.2: 104 files, 10.1MB, built in 3 seconds
为什么我会在curl is not executable
maven30
我也试过
brew tap homebrew/versions
Warning: homebrew/versions was deprecated. This tap is now empty as all its formulae were migrated.
答案 0 :(得分:1)
我从here下载了mvn
zip文件3.0.4,然后执行{bin}文件中的mvn
命令,如下所示
amar@admin:~/Downloads/apache-maven-3.0.4$ tree -L 2
├── LICENSE.txt
├── NOTICE.txt
├── README.txt
├── bin
│ ├── m2.conf
│ ├── mvn
│ ├── mvn.bat
│ ├── mvnDebug
│ ├── mvnDebug.bat
│ └── mvnyjp
现在转到bin文件夹并查询版本
amar@admin:~/Downloads/apache-maven-3.0.4/bin$ ./mvn -v
Apache Maven 3.0.4 (r1232337; 2012-01-17 03:44:56-0500)
Maven home: /Users/amar/Downloads/apache-maven-3.0.4
Java version: 1.8.0_144, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre
Default locale: en_CA, platform encoding: UTF-8
OS name: "mac os x", version: "10.13.2", arch: "x86_64", family: "mac"
现在它运行正常,另一步是卸载当前版本并使用brew uninstall maven
和brew unlink maven
现在您可以在bash_profile
中添加当前maven二进制文件的路径并获取它。以下是示例
export M2_HOME=/Users/amar/Downloads/apache-maven-3.0.4
export PATH=$PATH:$M2_HOME/bin
再次尝试检查版本,它对我有用
amar@admin:~$ mvn -v
Apache Maven 3.0.4 (r1232337; 2012-01-17 03:44:56-0500)
Maven home: /Users/amar/Downloads/apache-maven-3.0.4
Java version: 1.8.0_144, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre
Default locale: en_CA, platform encoding: UTF-8
OS name: "mac os x", version: "10.13.2", arch: "x86_64", family: "mac"
amar@admin:~$