Introduction
A software system is said to be portable if it can run on an operating system other than the one it was designed for without requiring major editing. The process of making computer software run in a new environment is known as porting.

To make sure that builds are portable, Apache Maven uses top levels of management. Portability, however, is only sometimes feasible. Maven offers the Build Profiles to solve these cases. This article will discuss the build profile in Maven and its types. We will discuss how to trigger profiles. Further, we will discuss how to activate it.
What is Build Profile in Maven?
Maven's profile is nothing more than a set of attributes that enables builds to be adjusted for a specific environment. A build environment is a particular environment that is configured for production and development instances.
A Build Profile in Maven is a collection of configuration parameters. You can use these parameters to override or change the default Maven build parameters. Using build profiles, you may modify builds for various situations, such as production and development environments.
Profile Element
The maven build profiles are specified using the profiles element in the POM(Project Object Model) file. A profile element contains every build profile that was created. The profile element's attributes will override attributes with the same name further up in the POM in terms of values.

There is an activation element inside every profile element. You can use the activation element to specify the circumstance that triggers the build profile to be applied.
There are two methods to instruct Maven on which profile to be used.
-
The settings.xml file can be used to instruct Maven.
-
Add -P <profile-name > command can be used.
The settings.xml file is used to set up a Maven installation. Similar to a pom.xml file, but either user- or globally-specific. Elements that describe the values necessary to configure Maven's execution in various ways are provided by the Maven settings.xml file. These parameters include,
-
The location of the local repository.
-
Authentication details.
-
Different servers for the remote repository etc.
Types of Build Profiles in Maven
There are three types of Build Profiles supported by Maven 3.0 and above.
-
Per Project: It is defined in the POM itself(pom.xml).
-
Per User: It is defined in the Maven settings(%USER HOME%/.m2/settings.xml).
- Global: It is defined in the Global Maven settings(${maven.home}/conf/settings.xml).