下载下来的maven压缩包,解压后,有个conf目录,下面有个setting.xml文件。
<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>
-->
我们可以看到,maven默认的仓库目录是 ${user.home}/.m2/repository
可以通过 <localRepository>/path/to/local/repo</localRepository>来配置目录
例如,我们要将本地仓库配置成D:\maven\repository
<localRepository>D:\maven\repository</localRepository>
加上上面这一句就可以了。