A profile can be specified in pom.xml
or settings.xml
. Each profile may be created for a specific purpose; for instance, to run on a particular platform or to run in an integration environment. All profiles may not need to run in all cases. Maven provides a mechanism to activate and deactivate a profile as required.
Let's perform the following steps to activate/deactivate a Maven profile:
To deactivate a profile, set the following value in the
activeByDefault
element:<activeByDefault>false</activeByDefault>
Run the Maven command to check if the profile is active:
mvn help:active-profiles
The output for the preceding command is shown as follows:
[INFO] --- maven-help-plugin:2.2:active-profiles (default-cli) @ project-with-profile --- [INFO] Active Profiles for Project 'com.packt.cookbook:project-with-profile:jar:1.0-SNAPSHOT': The following...