title: Maven ignores the "maven-compiler-plugin" requirements
body: <p>I am using Maven 3.0.5. I have an issue with the "maven-compile-plugin". Basically, I have 2 projects, the legacy one is in Java 6, and the new one is under Java 7. 
  My current JAVA_HOME is fine and is:</p>
  
  <p><code>$ echo $JAVA_HOME
  C:\Program Files (x86)\Java\jdk1.6.0_38</code></p>
  
  <p>In the new project, I use the maven-compile-plugin with this configuration:</p>
  
  <pre><code>    &lt;plugin&gt;
          &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
          &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
          &lt;version&gt;3.1&lt;/version&gt;
          &lt;configuration&gt;
              &lt;fork&gt;true&lt;/fork&gt;
              &lt;verbose&gt;true&lt;/verbose&gt;
              &lt;source&gt;1.7&lt;/source&gt;
              &lt;target&gt;1.7&lt;/target&gt;
              &lt;executable&gt;${JDK7}&lt;/executable&gt;
              &lt;compilerVersion&gt;1.7&lt;/compilerVersion&gt;
          &lt;/configuration&gt;
      &lt;/plugin&gt;
  </code></pre>
  
  <p>I have declared the JDK7 variable in the settings.xml:</p>
  
  <pre><code>    &lt;profiles&gt;
      &lt;profile&gt;
          &lt;id&gt;compiler&lt;/id&gt;
          &lt;properties&gt;
              &lt;JDK6&gt;C:\Program Files (x86)\Java\jdk1.6.0_38\bin\javac&lt;/JDK6&gt;
              &lt;JDK7&gt;C:\Program Files (x86)\Java\jdk1.7.0_45\bin\javac&lt;/JDK7&gt;
          &lt;/properties&gt;
      &lt;/profile&gt;
  &lt;/profiles&gt;
  &lt;activeProfiles&gt;
      &lt;activeProfile&gt;compiler&lt;/activeProfile&gt;
  &lt;/activeProfiles&gt;
  </code></pre>
  
  <p>In the new project, I am also using the enforcer plugin to check the compiled sources are  Java 7 compliant, so in my POM, I have:</p>
  
  <pre><code>&lt;plugin&gt;
  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
  &lt;artifactId&gt;maven-enforcer-plugin&lt;/artifactId&gt;
  &lt;version&gt;1.3.1&lt;/version&gt;
  &lt;executions&gt;
      &lt;execution&gt;
          &lt;id&gt;enforce-versions&lt;/id&gt;
          &lt;phase&gt;validate&lt;/phase&gt;
          &lt;goals&gt;
              &lt;goal&gt;enforce&lt;/goal&gt;
          &lt;/goals&gt;
          &lt;configuration&gt;
              &lt;rules&gt;
                  &lt;requireJavaVersion&gt;
                      &lt;version&gt;1.7&lt;/version&gt;
                  &lt;/requireJavaVersion&gt;
              &lt;/rules&gt;
          &lt;/configuration&gt;
      &lt;/execution&gt;
  &lt;/executions&gt;
  </code></pre>
  
  <p></p>
  
  <p>The thing I don't understand with Maven is that it always uses the compiler defined by the JAVA_HOME. Since it's defaulted to Java 6, when I build the new project, the enforcer plugin always fails cause Maven uses java 6:</p>
  
  <pre><code>        $ mvn compile -X
      Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 14:51:28+0100)
      Maven home: c:\Dev\apache-maven-3.0.5
      Java version: 1.6.0_38, vendor: Sun Microsystems Inc.
      Java home: c:\Program Files (x86)\Java\jdk1.6.0_38\jre
      Default locale: fr_FR, platform encoding: Cp1252
      OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
  [...]
  [INFO] --- maven-enforcer-plugin:1.3.1:enforce (enforce-versions) @ arom-wrapper ---
  [WARNING] Rule 0: org.apache.maven.plugins.enforcer.RequireJavaVersion failed with message:
  Detected JDK Version: 1.6.0-38 is not in the allowed range 1.7.
  </code></pre>
  
  <p>Could you please help me on this one ?</p>