I have 2 maven2 profiles, selenium and jspc. Now for "selenium" id'd like to have an implicit activation of "jspc", so that I don't have to write mvn -Pselenium,jspc from the command line. Is this possible ?
            Asked
            
        
        
            Active
            
        
            Viewed 3.4k times
        
    1 Answers
97
            You can't "chain" profile activations (maven reference) but you can activate them both through the same property:
<activation>
  <property>
    <name>profile.selenium</name>
  </property>
</activation>
And the run mvn -Dprofile.selenium
        Robert Munteanu
        
- 67,031
 - 36
 - 206
 - 278
 
- 
                    5http://stackoverflow.com/a/2248552/253686 has some more detail on *why* you can't chain. – bradley.ayers Apr 01 '14 at 00:00
 - 
                    Also, you can define activation based on properties NOT being there - this allows you to create mutually exclusive profiles (unless you force-activate both). E.g.
 – RobertG Jun 22 '18 at 14:48test-default  ...!profile.externalAndContractTests  - 
                    1For my case, I have `profile1` extends `profile2` extends `profile3`, so the above would not work because activation only can use one property. Instead I just use `maven-enforcer-plugin` with `requireProperty` and paste the `mvn install -Dprofile1,profile2,profile3` inside the requireProperty->message. So everytime I just do `mvn install profile3`, get the warning and copy the output message and run again. – Ng Sek Long Apr 26 '19 at 03:49
 - 
                    @bradley.ayers always someone trying to justify WHY. I can see 100 ways to implement this. Just look for profiles that match, unify them. – mjs Mar 11 '20 at 20:39