如何更改本地maven的本地仓库

为解决随着项目越来越大,本地仓库里的jar 也越来越多,C盘占用越来越多,现讲解自定义更改路径方法

1.默认本地仓库路径为: C:\Users\lenovo\.m2\repository    如:更改到  E:\m2\repository  中,此目录为自己新建

2. 找到安装的 maven 目录下的 setting.xml 文件,如:D:\maven\apache-maven-3.3.3-bin\apache-maven-3.3.3\conf\setting.xml

    修改 :如下图,添加一行代码:<localRepository>E:\m2\repository</localRepository> ,指定到你要存放的仓库的位置

  

3.打开Eclipse-->Preference-->Maven-->Installations-->add ,添加你的本地maven,如下图,

  finish 后,并勾选




4下一步,Eclipse-->Preference-->Maven-->User Settings,按照如图所示步骤操作,就可,慢慢等待下载必须文件到你要设置的仓库中。


 5.



猜你喜欢

转载自blog.csdn.net/ly10265139/article/details/50394948