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

  • Home
  • SEARCH
  • 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 4083862
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:22:00+00:00 2026-05-20T18:22:00+00:00

I know it’s impossible to chain profile declaration. It’s possible to do what I

  • 0

I know it’s impossible to “chain” profile declaration.
It’s possible to do what I want (but not completely) with System properties in command line like mvn -Dvar=value .
And then use this:

  <activation>
    <property>
      <name>var</name>
      <value>value</value>
    </property>            
  </activation>

or to activate simultaneously several profiles with -P profile1, profile2

In fact I have 4 profiles and I want to create a fifth profile with all the aspectj part (plugins, dependencies, …) which should be activated only if profile 1, 2 or 3 is activated. Like that I don’t have redundant plugins and dependencies declarations.

<profile>
  <id>profile1</id>
  <activation>
    <activeByDefault>true</activeByDefault>
  </activation>
  <build>
    ...     
  </build>
</profile>

<profile>
  <id>profile2</id>
  <build>
    ...     
  </build>
</profile>

<profile>
  <id>profile3</id>
  <build>
    ... 
  </build>
</profile>
<profile>
  <id>profile4</id>
  <build>
    <plugins>
      <plugin>
        ...
      </plugin>
    </plugins>
  </build>
</profile>

<profile>
  <id>aop</id>
  <build>
    <plugins>
      <plugin>
        ...
      </plugin>
    </plugins>
  </build>
  <dependencies>
    <dependency>
      ...
    </dependency>
    <dependency>
      ...
    </dependency>
  </dependencies>
</profile>

The problem is that profile 1 is the default profile and even it should be possible to do it without command line args. I tried with defining a value but it doesn’t work because activation property only works with system properties.

Am I wrong? Is there another way to do it?

Thanks

  • 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-20T18:22:01+00:00Added an answer on May 20, 2026 at 6:22 pm

    Maven won’t help you there, you can have no dependencies or inheritance between profiles, see also my recent answer to a related question.

    You can explicitly turn profiles on or off, but there is no way to define any relation between them. Maven is not ant, which is usually a good thing, but this is one of the cases where I think it should be more like ant.

    From Introduction to Build Profiles:

    A profile can be triggered/activated
    in several ways:

    • Explicitly
    • Through Maven settings
    • Based on environment variables
    • OS settings
    • Present or missing files

    None of these is helpful to define any relation between the profiles (Project properties can’t be used because Profiles are evaluated while the Project is built). So your only options are to

    • live with the restrictions and explicitly activate the profiles you need using the -P syntax
    • write a shell script that encapsulates the maven call and automatically adds missing profiles
    • Build your own replacement for DefaultProfileSelector, as outlined in my previous answer
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this is a silly doubt but I just want to make sure
Anyone know if it's possible to databind the ScaleX and ScaleY of a render
I know this might be a no-brainer, but please read on. I also know
I know, I would have thought the answer was obviously no as well, but
I know there is a registry key indicating the install directory, but I don't
I know I must be missing something, but in a while statement how does
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
know nothing about php, but I have this script that reads a folder and
Know this might be rather basic, but I been trying to figure out how
Know if it's possible to access the iPhone compass in Safari using JavaScript? I

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.