mac安裝maven3.8.8

习惯沉淀發表於2024-11-19

問題描述

down了一個新應用, maven依賴總是載入不到, 本地倉庫也能找到, 專案啟動報錯

org.apache.skywalking:apm-toolkit-trace:pom:5.0.0-RC-SNAPSHOT failed to transfer from http://0.0.0.0/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of maven-default-http-blocker has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.skywalking:apm-toolkit-trace:pom:5.0.0-RC-SNAPSHOT from/to maven-default-http-blocker (http://0.0.0.0/): Blocked mirror for repositories: [Lft-Local-Group (http://maven.lianjia.com/content/groups/Lft-Local-Group/, default, releases+snapshots), Lianjia-Local-Group (http://maven.lianjia.com/content/groups/Lianjia-Local-Group/, default, releases+snapshots), Bkjk-Provider-Group (http://maven.lianjia.com/content/groups/Bkjk-Provider-Group/, default, releases+snapshots)]

Since Maven 3.8.1 http repositories are blocked.

Possible solutions:
- Check that Maven settings.xml does not contain http repositories
- Check that Maven pom files do not contain http repository http://maven.lianjia.com/content/groups/Lft-Local-Group/
- Check that Maven pom files do not contain http repository http://maven.lianjia.com/content/groups/Lianjia-Local-Group/
- Check that Maven pom files do not contain http repository http://maven.lianjia.com/content/groups/Bkjk-Provider-Group/
- Add a mirror(s) for http://maven.lianjia.com/content/groups/Lft-Local-Group/, http://maven.lianjia.com/content/groups/Lianjia-Local-Group/, http://maven.lianjia.com/content/groups/Bkjk-Provider-Group/ that allows http url in the Maven settings.xml
- Downgrade Maven to version 3.8.1 or earlier in settings

本地maven版本是3.9.9

解決方案

1.官網下載3.8.8 https://maven.apache.org/download.cgi

2.解壓到目錄 /Users/liangyadong001/maven/apache-maven-3.8.8

3.編輯配置

sudo vim ~/.bash_profile

4.新增配置

export MAVEN_HOME=/Users/liangyadong001/maven/apache-maven-3.8.8

export PATH=$MAVEN_HOME/bin:$PATH

5.使配置生效

source ~/.bash_profile

6.驗證版本

mvn -version

如果發現沒生效, 重新開啟一個終端視窗 mvn -version 再看看

相關文章