該方法針對idea版本(2020.2.x)
1
2
3
4
5
6
7
8
9
10
|
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= "userSettingsFile" value= "D:\devtools\apache-maven-3.3.9\conf\settings.xml" /> </MavenGeneralSettings> </option> </component> |
1
2
3
4
5
6
7
8
9
10
11
|
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路徑做適當修改即可~
代碼如下:
1
2
3
4
5
|
<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> |
到這里,基本上就可以完美解決了~
總結
到此這篇關于intellij idea修改maven配置總是恢復默認配置的解決方法idea版本(2020.2.x)的文章就介紹到這了,更多相關idea修改maven配置內容請搜索服務器之家以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持服務器之家!
原文鏈接:https://blog.csdn.net/yuhaibao324/article/details/108068351