eclipse更改maven的本地路徑和外部倉庫地址

背景

  當前使用eclipse自帶的maven碰到兩個蛋疼的問題:html

  1. maven在國內使用若是不進行FQ則會痛苦不堪如便祕。
  2. maven下載大量jar包致使某盤不夠用,須要換大的分區。

  所以爲了解決這個問題就介紹兩個eclipse配置:maven本地路徑配置和maven外部路徑配置(改成阿里的倉庫,享受順香絲滑)。apache

方法

  • 進入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的本地路徑和遠程倉庫。eclipse

相關文章
相關標籤/搜索