title: Maven - activate profile based on project property
body: <p>Hi I am trying to achieve something like this:</p>
  
  <p>In a parent pom, I have</p>
  
  <pre><code>&lt;profile&gt;
    &lt;activation&gt;
      &lt;property&gt;
        &lt;name&gt;Compile&lt;/name&gt;
        &lt;value&gt;${project.artifactId}&lt;/value&gt;
      ...
  </code></pre>
  
  <p>so that if I run <code>mvn -DCompile=mod1 install</code> under the parent pom, it will only apply the profile settings to module 1, but not the others.</p>
  
  <p>Similarly, if I have</p>
  
  <pre><code>&lt;profile&gt;
    &lt;activation&gt;
      &lt;property&gt;
        &lt;name&gt;Compile&lt;/name&gt;
        &lt;value&gt;${project.packaging}&lt;/value&gt;
      ...
  </code></pre>
  
  <p>then running <code>mvn -DCompile=war install</code> under the parent pom, it will only apply the profile settings to those to be packed as war but not jar nor pom.</p>
  
  <p>I tried but it didnt work as expected. Did I miss anything? Please help.</p>
  
  <p>P.S. no need to suggest workarounds as I am only interested on this method. Simply answer it is not possible with reason if thats the case. Thank you</p>