背景
當前使用eclipse自帶的maven碰到兩個蛋疼的問題:
- maven在國內使用如果不進行FQ則會痛苦不堪如便秘。
- maven下載大量jar包導致某盤不夠用,需要換大的分區。
因此為了解決這個問題就介紹兩個eclipse配置:maven本地路徑配置和maven外部路徑配置(改為阿里的倉庫,享受順香絲滑)。
方法
- 進入eclipse的maven配置界面Window》Preferences>Maven>User Settings
- 你會發現eclipse自帶的maven是沒有settings文件的,所以你需要在計算機/用戶/.m2文件夾中建一個settings.xml文件,內容如下:
<?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <localRepository>C:\Users\Ocean\.m2\repository</localRepository> <mirrors> <mirror> <id>nexus-aliyun</id> <mirrorOf>*</mirrorOf> <name>Nexus aliyun</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> </mirror> </mirrors> </settings>
- 下面這個是配置你的本地倉庫地址
<localRepository>C:\Users\Ocean\.m2\repository</localRepository>
- 下面的是配置阿里巴巴的maven倉庫,享受快速加載,感謝阿里!
<mirror> <id>nexus-aliyun</id> <mirrorOf>*</mirrorOf> <name>Nexus aliyun</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> </mirror>
- 建好settings文件后首先Browse文件,然后Reindex。
- 簡單的兩步就配置完成了
結束
以上就是如果配置eclipse自帶maven的本地路徑和遠程倉庫。