title: Activate Maven profile if another profile is not activated
body: <p>The question is related to <a href="https://stackoverflow.com/questions/7344728/maven-only-activate-profile-a-if-profile-b-is-not-activated">Maven: Only activate profile A if profile B is not activated?</a>, but it's more specific.</p>
  
  <p>If I type one of the following:</p>
  
  <pre class="lang-bash prettyprint-override"><code>mvn clean install -PspecificProfile
  mvn clean install -Dsmth -PspecificProfile
  mvn clean install -Dsmth -PspecificProfile,anotherProfile
  </code></pre>
  
  <p>then I want to <strong>activate the <code>specificProfile</code></strong> profile. (+the additional specified profiles)</p>
  
  <p>If I type anything else like:</p>
  
  <pre class="lang-bash prettyprint-override"><code>mvn install
  mvn clean install
  mvn clean install -Dsmth
  mvn clean install -Dsmth -PanotherProfile
  mvn clean install -Dsmth -PdefaultProfile
  mvn clean install -Dsmth -PdefaultProfile,anotherProfile
  </code></pre>
  
  <p>then I want to <strong>activate the <code>defaultProfile</code></strong>(+the additional specified profiles).</p>
  
  <h2>Idea:</h2>
  
  <pre><code>if ( specific profile P is used via command line ) {
      activate P;
  } else {
      activate the default profile;
  }
  activate other specified profiles;
  </code></pre>
  
  <h2>Examples:</h2>
  
  <pre><code>mvn ...                          // default
  mvn ... -PspecificProfile        // specificProfile           (no default!)
  mvn ... -Px                      // default + x
  mvn ... -Px,y                    // default + x + y
  mvn ... -Px,specificProfile      // x + specificProfile       (no default!)
  mvn ... -Px,specificProfile,y    // x + specificProfile + y   (no default!)
  </code></pre>
  
  <hr>
  
  <p>I tried to do something like this (in <strong>pom.xml</strong>):</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;profile&gt;
      &lt;id&gt;defaultProfile&lt;/id&gt;
      &lt;activation&gt;
          &lt;property&gt;!x&lt;/property&gt;
      &lt;/activation&gt;
      ...
  &lt;/profile&gt;
  &lt;profile&gt;
      &lt;id&gt;specificProfile&lt;/id&gt;
      &lt;properties&gt;
          &lt;x&gt;true&lt;/x&gt;
      &lt;/properties&gt;
      ...
  &lt;/profile&gt;
  </code></pre>
  
  <p>but it doesn't work.</p>