Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6554467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:42:11+00:00 2026-05-25T12:42:11+00:00

I have two Maven profiles profile-A and profile-B. B should only be activated if

  • 0

I have two Maven profiles profile-A and profile-B. “B” should only be activated if “A” is not activated.
So if I would call

mvn install

profile-B is executed (but not profile-A).
But if I would call

mvn install -Pprofile-A

then only profile-A is executed (but not profile-B).

Any hints how I need to write my pom.xml to achieve this?

I already tried this, but it doesn’t work:

<profiles>
  <profile>
    <id>profile-A</id>
    <activation>
      <activeByDefault>false</activeByDefault>
    </activation>
    ...
  </profile>

  <profile>
    <id>profile-B</id>
    <activation>
      <activeByDefault>true</activeByDefault>
      <property>
        <name>!profile-A</name>
      </property>       
      ...
    </activation>
    ...
  </profile>
</profiles>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T12:42:12+00:00Added an answer on May 25, 2026 at 12:42 pm

    I think for your example command line to work as expected, all you need is the <activeByDefault>true</activeByDefault> for profile B.

    http://maven.apache.org/guides/introduction/introduction-to-profiles.html states:

    All profiles that are active by default are automatically deactivated when a profile in the POM is activated on the command line or through its activation config.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have two maven profiles for running projects web tests: 1. first
I have a Maven multi-module project and I need two different parent POMs in
Currently, I have a Maven project which inherits from a parent pom defining two
I have two maven projects Project AAA AAA-Core AAA-Other Project BBB BBB-Core BBB-AAA-specific I
I have two maven projects: project-api project-impl project-impl's POM specifies a dependency on project-api.
I have two set of integration tests in one maven project - automatic and
I have two profiles that are nearly identical. Rather than duplicating the configuration in
I have two maven projects, the second project extends some classes of first project.
I have two Maven modules, A and B . A is a dependency of
I have small project consisting of one maven project and two maven modules. One

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.