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

Adding a new Maven profile

Let us add a simple Maven profile to test our understanding of profiles.

How to do it...

Let's create a new Maven profile, by performing the following steps:

  1. Create a new Maven project using the commands specified in the Creating a simple project with Maven recipe in Chapter 1, Getting Started.
  2. Add the following code in the pom.xml file:
    <profiles>
          <profile>
              <id>dev</id>
              <activation>
                  <activeByDefault>false</activeByDefault>
              </activation>
          </profile>
      </profiles>

How it works...

There are two ways to create a profile: in the project's pom file or in the settings file. It is important to note that, if a profile is active from the settings file, its values will override any profiles with equivalent IDs in the pom file.

The profile ...

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