在maven項目導入jar包坐標時需要連接maven官方倉庫下載,但是下載速度感人,所以來修改一下設置。
設置成為本地倉和連接阿里雲的遠程倉庫。(本地倉如果沒有需要的jar包)
- 找出相應配置文件:例如我的目錄:C:\soft\apache-maven-3.6.2\conf\settings.xml找到settings.xml。
- 用notepad++打開setting.xml文件。找到<localRepository>這個標簽
<!-- localRepository | The path to the local repository maven will use to store artifacts. | | Default: ${user.home}/.m2/repository <localRepository>/path/to/local/repo</localRepository> -->
插入下面這行標紅代碼,一般情況下是在50行左右
主要作用是設置自己的本地倉庫路徑。例如我的本地倉路徑是在C:\soft\repo
<localRepository>C:\soft\repo</localRepository>
3.找到<mirrors> </mirrors>這兩個標簽
4.在標簽中添加:
<mirror> <id>alimaven</id> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> <mirrorOf>central</mirrorOf> </mirror>
這個主要是設置阿里雲的遠程倉庫。
下面是我的配置文件的截圖: