intellij idea修改maven配置时总是恢复默认配置的解决方法idea版本(2020.2.x)
作者:yuhaibao324 时间:2023-06-30 23:56:10
该方法针对idea版本(2020.2.x)
C:\Users\yanghao\AppData\Roaming\JetBrains\IntelliJIdea2020.2\options\project.default.xml
<component name="MavenImportPreferences">
<option name="generalSettings">
<MavenGeneralSettings>
<option name="localRepository" value="D:\repository" />
<option name="mavenHome" value="D:/devtools/apache-maven-3.3.9" />
<option name="userSettingsFile" value="D:\devtools\apache-maven-3.3.9\conf\settings.xml" />
</MavenGeneralSettings>
</option>
</component>
D:\myprojects\demo003\.idea\workspace.xml
<component name="MavenImportPreferences">
<option name="generalSettings">
<MavenGeneralSettings>
<option name="localRepository" value="D:\repository" />
<option name="mavenHome" value="D:\devtools\apache-maven-3.3.9" />
<option name="userSettingsFile" value="D:\devtools\apache-maven-3.3.9\conf\settings.xml" />
</MavenGeneralSettings>
</option>
</component>
1、对新建项目有用
首先设置新项目配置,File ——>New Projects Settings —>Settings for New Projects…—>设置maven—>Apply—>OK
2、如果发现没用或者要对已有项目设置,可以暴力一些,直接修改idea默认的project.default.xml文件
我的project.default.xml文件是在这个地方C:\Users\yanghao\AppData\Roaming\JetBrains\IntelliJIdea2020.2\options\project.default.xml
如果真的找不到,直接用everything搜索,project.default.xml
然后修改里面的MavenGeneralSettings改成自己的maven配置,下面是我修改成功的代码,然后根据你的maven路径做适当修改即可~
代码如下:
<MavenGeneralSettings>
<option name="localRepository" value="D:\Program Files\Environment\apache-maven-3.6.3\maven-repo" />
<option name="mavenHome" value="D:/Program Files/Environment/apache-maven-3.6.3" />
<option name="userSettingsFile" value="D:\Program Files\Environment\apache-maven-3.6.3\conf\settings.xml" />
</MavenGeneralSettings>
到这里,基本上就可以完美解决了~
来源:https://blog.csdn.net/yuhaibao324/article/details/108068351
标签:idea,maven,配置
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
SpringMVC+Shiro的基本使用及功能介绍
2021-11-26 13:12:40
![](https://img.aspxhome.com/file/2023/2/126342_0s.png)
Spring Boot实现配置文件的自动加载和刷新功能
2023-07-14 02:26:55
![](https://img.aspxhome.com/file/2023/1/82381_0s.png)
小白2分钟学会Visual Studio如何将引用包打包到NuGet上
2022-01-14 10:25:53
![](https://img.aspxhome.com/file/2023/9/70439_0s.jpg)
Java正则多字符串匹配替换
2021-12-16 02:24:48
C#中使用强制类型实现字符串和ASCII码之间的转换
2022-05-15 14:57:48
Android13 加强Intent filters 的安全性
2022-06-17 03:15:55
详解在Spring中如何自动创建代理
2023-11-15 15:28:52
![](https://img.aspxhome.com/file/2023/2/59172_0s.png)
C#使用Task实现异步方法
2022-09-02 20:26:53
![](https://img.aspxhome.com/file/2023/6/70436_0s.jpg)
java String类常量池分析及"equals"和"==”区别详细介绍
2021-11-28 01:54:48
Java实现分页的前台页面和后台代码
2021-07-22 17:10:04
![](https://img.aspxhome.com/file/2023/1/61381_0s.jpg)
android通过google api获取天气信息示例
2023-10-18 15:44:22
android实现注册页面开发
2023-09-09 14:37:12
![](https://img.aspxhome.com/file/2023/1/137731_0s.jpg)
在编程语言中怎样定义队列及其使用(C++)
2021-05-28 14:00:43
![](https://img.aspxhome.com/file/2023/4/124034_0s.jpg)
Mybatis plus多租户方案的实战踩坑记录
2023-08-01 05:19:09
![](https://img.aspxhome.com/file/2023/6/57956_0s.jpg)
Java模拟qq软件的详细过程
2022-01-27 15:06:19
![](https://img.aspxhome.com/file/2023/9/73069_0s.png)
IDEA SpringBoot项目配置热更新的步骤详解(无需每次手动重启服务器)
2023-11-12 00:22:41
![](https://img.aspxhome.com/file/2023/9/59659_0s.jpg)
java中方法递归的简单示例
2022-11-25 11:45:12
![](https://img.aspxhome.com/file/2023/1/66041_0s.png)
Java之Mybatis多层嵌套查询方式
2023-06-17 11:48:52
![](https://img.aspxhome.com/file/2023/7/71857_0s.png)
详解Mybatis注解写法(附10余个常用例子)
2023-01-19 03:39:53
![](https://img.aspxhome.com/file/2023/7/113187_0s.jpg)
将15位身份证补全为18位身份证的算法示例详解
2022-07-15 19:33:43
![](https://img.aspxhome.com/file/2023/4/132044_0s.png)