Maven toolchain not getting triggered in build
<p>I'm using the latest maven 3.3.9 which enforces java 8, and trying to compile a project in java 7 using a java 7 maven toolchain.  </p>

<p>As per:  <a href="https://maven.apache.org/guides/mini/guide-using-toolchains.html" rel="nofollow">The maven guide</a> I've put in the maven toolchain plugin to try and tell it to use java 7 to compile the app.  My project setup is as follows:</p>

<ul>
<li><p>top_module --> (have put in maven toolchain plugin in this pom.xml)</p>

<p>---submodule1</p>

<p>---submodule2</p></li>
</ul>

<p>This is my parent pom.xml:</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;parent&gt;
        &lt;groupId&gt;parent&lt;/groupId&gt;
        &lt;artifactId&gt;build-base&lt;/artifactId&gt;
        &lt;version&gt;1.0.17&lt;/version&gt;
    &lt;/parent&gt;

    &lt;groupId&gt;top_module&lt;/groupId&gt;
    &lt;artifactId&gt;top_module&lt;/artifactId&gt;
    &lt;version&gt;1&lt;/version&gt;
    &lt;packaging&gt;pom&lt;/packaging&gt;
    &lt;name&gt;${project.artifactId}&lt;/name&gt;

    &lt;modules&gt;
        &lt;module&gt;submodule1&lt;/module&gt;
        &lt;module&gt;submodule2&lt;/module&gt;
    &lt;/modules&gt;

    &lt;properties&gt;


        ...

    &lt;/properties&gt;

    &lt;dependencyManagement&gt;
        &lt;dependencies&gt;

            &lt;dependency&gt;
                ...
            &lt;/dependency&gt;
            &lt;dependency&gt;
                ...
            &lt;/dependency&gt;
        &lt;/dependencies&gt;
    &lt;/dependencyManagement&gt;

    &lt;dependencies&gt;
        &lt;dependency&gt;
            ...
        &lt;/dependency&gt;
    &lt;/dependencies&gt;

    &lt;build&gt;
        &lt;pluginManagement&gt;
            &lt;plugins&gt;
                &lt;!-- Ensure we compile as the correct jdk version --&gt;
                &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;/plugin&gt;
                &lt;plugin&gt;
                    &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                    &lt;artifactId&gt;maven-toolchains-plugin&lt;/artifactId&gt;
                    &lt;version&gt;1.1&lt;/version&gt;
                    &lt;executions&gt;
                        &lt;execution&gt;
                            &lt;goals&gt;
                                &lt;goal&gt;toolchain&lt;/goal&gt;
                            &lt;/goals&gt;
                        &lt;/execution&gt;
                    &lt;/executions&gt;
                    &lt;configuration&gt;
                        &lt;toolchains&gt;
                            &lt;jdk&gt;
                                &lt;version&gt;1.7&lt;/version&gt;
                                &lt;vendor&gt;sun&lt;/vendor&gt;
                            &lt;/jdk&gt;
                        &lt;/toolchains&gt;
                    &lt;/configuration&gt;
                &lt;/plugin&gt;

                &lt;!-- Maven WAR Plugin --&gt;
                &lt;plugin&gt;
                    &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
                    &lt;version&gt;${maven.war.plugin.version}&lt;/version&gt;
                    &lt;inherited&gt;true&lt;/inherited&gt;
                    &lt;configuration&gt;
                        &lt;archiveClasses&gt;true&lt;/archiveClasses&gt;
                    &lt;/configuration&gt;
                &lt;/plugin&gt;

                &lt;plugin&gt;
                    &lt;groupId&gt;org.eclipse.m2e&lt;/groupId&gt;
                    &lt;artifactId&gt;lifecycle-mapping&lt;/artifactId&gt;
                    &lt;version&gt;1.0.0&lt;/version&gt;
                    &lt;configuration&gt;
                        &lt;lifecycleMappingMetadata&gt;
                            &lt;pluginExecutions&gt;
                                &lt;pluginExecution&gt;
                                    &lt;pluginExecutionFilter&gt;
                                        &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                                        &lt;artifactId&gt;maven-enforcer-plugin&lt;/artifactId&gt;
                                        &lt;versionRange&gt;[1.0.0,)&lt;/versionRange&gt;
                                        &lt;goals&gt;
                                            &lt;goal&gt;enforce&lt;/goal&gt;
                                        &lt;/goals&gt;
                                    &lt;/pluginExecutionFilter&gt;
                                    &lt;action&gt;
                                        &lt;ignore /&gt;
                                    &lt;/action&gt;
                                &lt;/pluginExecution&gt;
                            &lt;/pluginExecutions&gt;
                        &lt;/lifecycleMappingMetadata&gt;
                    &lt;/configuration&gt;
                &lt;/plugin&gt;

            &lt;/plugins&gt;
        &lt;/pluginManagement&gt;
    &lt;/build&gt;

    ...

&lt;/project&gt;
</code></pre>

<p>The build doesn't run any toolchain related steps and conks out when running <code>mvn clean install</code> due to a plugin being incompatible with java 8, which obviously means the toolchain isn't getting run.  Do I need anything else in the pom?</p>

<p>This is my toolchains.xml file in my M2_HOME:</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF8"?&gt;
    &lt;toolchains&gt;
      &lt;!-- JDK toolchains --&gt;
      &lt;toolchain&gt;
        &lt;type&gt;jdk&lt;/type&gt;
        &lt;provides&gt;
          &lt;version&gt;1.6&lt;/version&gt;
          &lt;vendor&gt;sun&lt;/vendor&gt;
        &lt;/provides&gt;
        &lt;configuration&gt;
          &lt;jdkHome&gt;C:\Java\jdk1.6.0_45&lt;/jdkHome&gt;
        &lt;/configuration&gt;
      &lt;/toolchain&gt;

            &lt;toolchain&gt;
        &lt;type&gt;jdk&lt;/type&gt;
        &lt;provides&gt;
          &lt;version&gt;1.7&lt;/version&gt;
          &lt;vendor&gt;sun&lt;/vendor&gt;
        &lt;/provides&gt;
        &lt;configuration&gt;
          &lt;jdkHome&gt;C:\Java\jdk1.7.0_79&lt;/jdkHome&gt;
        &lt;/configuration&gt;
      &lt;/toolchain&gt;
    &lt;/toolchains&gt;
</code></pre>