Maven工程目录下,除了有pom.xml文件以外,还有一个settings.xml。 settings.xml, 包含了以下标签:
<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
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository/>
<interactiveMode/>
<usePluginRegistry/>
<offline/>
<pluginGroups/>
<servers/>
<mirrors/>
<proxies/>
<profiles/>
<activeProfiles/>
</settings>
<localRepository>就是默认的本地代码仓,默认是 ${user.home}/.m2/repository。
<interactiveMode> (命令行下)如果Maven试图与用户交互以获取输入,则为true;如果不是,则为false。默认值为true。
<usePluginRegistry> Maven是否使用${user.home}/.m2/plugin-registry管理插件版本,默认为false
<offline> 是否在离线模式下操作,默认为false。 如果连接不上远程代码仓,可以使用true。
<servers> 在<repositories>和<distributionManagement>标签下可能定义了一些远程代码仓,一些代码仓库的访问需要授权,在<servers>标签下配置访问用户和密码。
<mirrors> 为远程仓库做镜像,提高访问速率和效率。
<proxies> 用于指定一系列的profile。profile元素由activation、repositories、pluginRepositories和properties四个元素组成。当一个profile在settings.xml中是处于活动状态并且在pom.xml中定义了一个相同id的profile时,settings.xml中的profile会覆盖pom.xml中的profile。
<activeProfiles> 底包含一系列的activeProfile元素,表示对于所有的pom都处于活跃状态的profile。
在必要时,了解这些标签的意义,才能完成对应的配置。