Java-如何设置Maven本地仓库不使用C盘默认仓库
原创约 529 字大约 2 分钟...
67-Java-如何设置Maven本地仓库不使用C盘默认仓库.md
注意
本博文仅供学术研究和交流参考,严禁将其用于商业用途。如因违规使用产生的任何法律问题,使用者需自行负责。
首先确定经搭建好Maven环境,若不会搭建请参考博客 Java-Window10-Maven环境搭建
Eclipse 依次点击 window ---> Preferences ---> Maven ---> User Settings 可以看到Eclipse集成的Maven本地仓库目录是在C盘,那么我们接下来就需要更改这个路径。

- Eclipse依次点击 window ---> Preferences ---> Maven ---> Installations, 右侧点击 Add

- 设置Maven的安装目录,然后Finish

- 选中刚刚添加的Maven,并Apply

- 打开 Window ---> Preferences ---> Maven ---> User Settings 配置如下

- 点击Open file 配置 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>D:\Program Files\soft\apache-maven-3.6.1</localRepository>
<pluginGroups>
</pluginGroups>
<proxies>
</proxies>
<servers>
</servers>
<mirrors>
</mirrors>
<profiles>
</profiles>
</settings>
- 配置完 settings.xml 保存后 打开确认路径是否有更改,如图所示Rejndex路径已自动更改咯

2019/06/27补充
- D:\Program Files\soft\apache-maven-3.6.1目录下最后再新建一个repository文件夹
<?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>D:\Program Files\soft\apache-maven-3.6.1\respository</localRepository>
<pluginGroups>
</pluginGroups>
<proxies>
</proxies>
<servers>
</servers>
<mirrors>
</mirrors>
<profiles>
</profiles>
</settings>

- 将之前C:\Users\yanbo.m2\repository的Maven所下载的文件全部剪切到现在新的配置D:\Program Files\soft\apache-maven-3.6.1\respository仓库里,然后重启Eclipse
- 至此就完成咯对Eclipse里的默认Maven本地仓库的更改
分割线
相关信息
以上就是我关于 Java-如何设置Maven本地仓库不使用C盘默认仓库 知识点的整理与总结的全部内容
Powered by Waline v2.15.4