Profiles is a key term for Maven: profile is used to define some of the environmental variations that are used in build lifecycle, Profile can be set to activate different profiles in different environments (for example: Different OS activates different profiles, different JVMs activate different profiles, different dabase activate different profiles, etc.).
Define Profiles
You can define the profiles in 4 places:
%m2_home%/conf/settings.xml, this is the profiles for all user of the computer, global profiles, which affects all MAVEN project builds
<your-home-directory>/.m2/settings.xml, which is profiles for per user, is a user-level profiles that affects all MAVEN project for the current user Build
Defined in the Pom.xml file, which is profiles for this project only, and is a project-level profiles
Profiles.xml, it and Pom.xml in the same directory, is also a project-level profiles, the purpose of using Profiles.xml is to want to profiles settings from the Pom.xml out of the set.
Defined in the profiles of these 4 places, the narrower profiles covers the wider profiles. Namely: the definition in Pom.xml profiles will cover Profiles.xml, Profiles.xml will cover <your-home-directory>/.m2/settings.xml, <your- The Home-directory>/.m2/settings.xml will cover the%m2_home%/conf/settings.xml.
However, please note: The Profiles set in Pom.xml is the most recommended, because Pom.xml will be deploy to Repository, so pom.xml profiles will available for subsequent Builds originating from the repository or as transitive dependencies. While the profiles defined in Settings.xml and profiles.xml are not deploy to Repository, there are a number of limitations, so only the following profiles can be defined in Settings.xml and profiles.xml:
Repositories
Pluginrepositories
Properties
Other types of profiles must be defined in Pom.xml (above 3 profiles can also be defined in Pom.xml).
The profiles that Pom.xml can define include:
<repositories>
<pluginRepositories>
<dependencies>
<plugins>
<properties> (not actually available in the main POM, but used behind the scenes)
<modules>
<reporting>
<dependencyManagement>
<distributionManagement>
a subset of the <build> element, which consists of:
<defaultGoal>
<resources>
<testResources>
<finalName>