前言
Apache Maven預設使用的Local Repository路徑為${user.home}/.m2/repository
,一般情況下楊藝也不會去更改這個預設值,不過如果想更改的話其實也是可以做得到,畢竟有些人不免會想要自訂路徑,這個時候就得至Apache Maven目錄下修改settings.xml
設定檔。
實作
settings.xml
路徑於${maven_home}/conf/settings.xml
,開啟settings.xml
找到以下內容。
1
2
3
4
5
6
7
8
9
| <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
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository
<localRepository>/path/to/local/repo</localRepository>
-->
|
如要修改僅需要修改<localRepository>/path/to/local/repo</localRepository>
標籤中的內容即可。
示範如下
1
| <localRepository>D:/maven/repository</localRepository>
|