title: Define different value per profile for same Maven property
body: <p>I'm facing a problem with maven property per profiles. I have two profiles, each one has the same property 'prop.key' with different values. When I call <code>mvn clean package -PA -PB</code> or <code>mvn clean package -PB -PA</code> both are using the same value '<em>B-1.0-SNAPSHOT</em>'. I'm using maven 3.0.4.</p>
  
  <p>Below my POM :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;com.test.module&lt;/groupId&gt;
      &lt;artifactId&gt;test-module&lt;/artifactId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;pom&lt;/packaging&gt;
      &lt;properties&gt;
          &lt;prop.key&gt;UNKNOWN&lt;/prop.key&gt;
      &lt;/properties&gt;
  
      &lt;profiles&gt;
          &lt;profile&gt;
              &lt;id&gt;A&lt;/id&gt;
              &lt;properties&gt;
                  &lt;prop.key&gt;A-${project.version}&lt;/prop.key&gt;
              &lt;/properties&gt;
              &lt;build&gt;
                  &lt;plugins&gt;
                      &lt;plugin&gt;
                          &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                          &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt;
                          &lt;version&gt;1.2&lt;/version&gt;
                          &lt;executions&gt;
                              &lt;execution&gt;
                                  &lt;id&gt;A&lt;/id&gt;
                                  &lt;phase&gt;package&lt;/phase&gt;
                                  &lt;configuration&gt;
                                      &lt;tasks name="a" description="a-desc"&gt;
                                          &lt;echo message="RUN A = ${prop.key}" level="info"/&gt;
                                      &lt;/tasks&gt;
                                  &lt;/configuration&gt;
                                  &lt;goals&gt;
                                      &lt;goal&gt;run&lt;/goal&gt;
                                  &lt;/goals&gt;
                              &lt;/execution&gt;
                          &lt;/executions&gt;
                      &lt;/plugin&gt;
                  &lt;/plugins&gt;
              &lt;/build&gt;
          &lt;/profile&gt;
  
          &lt;profile&gt;
              &lt;id&gt;B&lt;/id&gt;
              &lt;properties&gt;
                  &lt;prop.key&gt;B-${project.version}&lt;/prop.key&gt;
              &lt;/properties&gt;
              &lt;build&gt;
                  &lt;plugins&gt;
                      &lt;plugin&gt;
                          &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                          &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt;
                          &lt;version&gt;1.2&lt;/version&gt;
                          &lt;executions&gt;
                              &lt;execution&gt;
                                  &lt;id&gt;B&lt;/id&gt;
                                  &lt;phase&gt;package&lt;/phase&gt;
                                  &lt;configuration&gt;
                                      &lt;tasks name="b" description="b-desc"&gt;
                                          &lt;echo message="RUN B = ${prop.key}" level="info"/&gt;
                                      &lt;/tasks&gt;
                                  &lt;/configuration&gt;
                                  &lt;goals&gt;
                                      &lt;goal&gt;run&lt;/goal&gt;
                                  &lt;/goals&gt;
                              &lt;/execution&gt;
                          &lt;/executions&gt;
                      &lt;/plugin&gt;
                  &lt;/plugins&gt;
              &lt;/build&gt;
          &lt;/profile&gt;
      &lt;/profiles&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>I have found <a href="https://stackoverflow.com/questions/9310545/maven-profile-properties-are-not-overriding">'similar topic'</a> but with opposite result!
  Is it a bug or a feature of maven? </p>