O'Reilly logo

Apache Maven Cookbook by Raghuram Bharathan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Activating/deactivating a Maven profile

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.

Getting ready

Use the project where we created the profile to add a new Maven profile section.

How to do it...

Let's perform the following steps to activate/deactivate a Maven profile:

  1. To deactivate a profile, set the following value in the activeByDefault element:
    <activeByDefault>false</activeByDefault>
  2. Run the Maven command to check if the profile is active:
    mvn help:active-profiles
    

    The output for ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required