profiles定义4个地方:
1,%M2_HOME%/conf/settings.xml,这针该部电脑所有userprofiles,global profiles,影响所有maven project build
2,/.m2/settings.xml,这针per userprofiles,user级profiles,影响当user所有maven project build
3,定义pom.xml文里面,这仅针该projectprofiles,project级profiles
4,profiles.xml,pom.xml同个目录,project级profiles,使profiles.xml目希望profiles设置从pom.xml里抽离出设置。
定义这4个地方profiles,涉及范围越窄profiles覆盖范围越宽profiles。即:定义pom.xml里profiles覆盖profiles.xml,profiles.xml覆盖/.m2/settings.xml,/.m2/settings.xml覆盖%M2_HOME%/conf/settings.xml。
设置pom.xml里profiles最最推荐,因pom.xml被deployrepository里,所以pom.xml里profiles才available for subsequent builds originating from the repository or as transitive dependencies。而settings.xmlprofiles.xml里定义profiles不被deployrepository,则有诸限制,因此,只有面几个profiles能够settings.xmlprofiles.xml里定义:
repositories
pluginRepositories
properties
其类型profiles必须pom.xml里定义(面3个profiles以pom.xml里定义)。
pom.xml能够定义profiles包括:
(not actually available in the main POM, but used behind the scenes)
a subset of the element, which consists of: