先貼一下Maven官網關於settings.xml配置文件的使用說明:
There are two locations where a settings.xml file may live:
- The Maven install: ${maven.home}/conf/settings.xml
- A user’s install: ${user.home}/.m2/settings.xml
The former settings.xml are also called global settings, the latter settings.xml are referred to as user settings. If both files exists, their contents gets merged, with the user-specific settings.xml being dominant.
Tip: If you need to create user-specific settings from scratch, it’s easiest to copy the global settings from your Maven installation to your ${user.home}/.m2 directory. Maven’s default settings.xml is a template with comments and examples so you can quickly tweak it to match your needs.
Maven安裝目錄的settings.xml,是提供作為模版供用戶使用的
Maven安裝目錄的settings.xml,是全局級別的配置
用戶指定的settings.xml,是用戶級別的配置
如果這兩個級別的配置文件,都做了配置。Maven會把兩個配置文件的配置內容合並,並以優先使用用戶級別的配置。
日常使用Maven時,全局配置---Maven安裝目錄的settings.xml,建議不要做具體配置,按照maven官方文檔傳達的精神,當作模版使用。使用用戶級別的配置文件做配置就好了。