Idea加载maven时,需要一系列的配置,这里讲述一下xml文件默认加载配置。
一、页面配置
一般情况下,都是修改idea中的属性配置,如图。
这种配置方式,在拉取新项目或者某些情况下,需要重新更改设置,有点麻烦。
二、文件配置
通过对Idea的配置文件修改,使Idea启动默认加载,解决上述问题,一劳永逸。
打开路径,一般是在C盘用户目录下:C:\Users\XIN\AppData\Roaming\JetBrains\IntelliJIdea2021.1\options
在此文件夹下,有一个默认加载的配置文件:project.default.xml(若没有,可以自己新建一个),更改MavenGeneralSettings属性配置。
下面是我的配置,可参考。
<application>
<component name="ProjectManager">
<defaultProject>
<component name="AnalysisProjectProfileManager">
<option name="PROJECT_PROFILE" />
<option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
<list size="0" />
</component>
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
<component name="MavenImportPreferences">
<option name="generalSettings">
<MavenGeneralSettings>
<option name="localRepository" value="D:\APP\Java\Apache Maven 3.8.1\Repository" />
<option name="mavenHome" value="D:\APP\Java\Apache Maven 3.8.1\apache-maven-3.8.1" />
<option name="userSettingsFile" value="D:\APP\Java\Apache Maven 3.8.1\apache-maven-3.8.1\conf\settings.xml" />
</MavenGeneralSettings>
</option>
</component>
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showExcludedFiles" value="false" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
<property name="project.structure.last.edited" value="Project" />
<property name="project.structure.proportion" value="0.0" />
<property name="project.structure.side.proportion" value="0.0" />
<property name="settings.editor.selected.configurable" value="preferences.fileTypes" />
</component>
<component name="SuppressionsComponent">
<option name="suppComments" value="[]" />
</component>
<component name="masterDetails">
<states>
<state key="GlobalLibrariesConfigurable.UI">
<settings>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="JdkListConfigurable.UI">
<settings>
<last-edited>1.8</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="ProjectJDKs.UI">
<settings>
<last-edited>1.8</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="ProjectLibrariesConfigurable.UI">
<settings>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</defaultProject>
</component>
</application>