javaxmleclipsemavenmaven-toolchains-plugin

Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-toolchains-plugin:1.1:toolchain


I am using m2e to build a java project. I need to use JAVA VERSION 1.6 . So i am trying to configure toolchains plugin to achieve it. by referring the below link.

https://maven.apache.org/guides/mini/guide-using-toolchains.html

But in eclipse it is throwing the below error.

Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-toolchains-plugin:1.1:toolchain (execution: default, phase: validate) pom.xml /Replenishment line 98 Maven Project Build Lifecycle Mapping Problem

I referred the link but i did not get a proper clarity. Below is the code snippet used for configuring tool chains plugin.

IN pom.XML

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-toolchains-plugin</artifactId>
        <version>1.1</version>
        <lifecycleMappingMetadata>
               <pluginExecutions>
                  <pluginExecution>
                      <pluginExecutionFilter>
                          <groupId>
                              org.apache.maven.plugins
                          </groupId>
                          <artifactId>
                              maven-toolchains-plugin
                          </artifactId>
                          <versionRange>
                              [1.1,)
                          </versionRange>
                          <goals>
                              <goal>toolchain</goal>
                          </goals>
                      </pluginExecutionFilter>
                      <action>
                          <ignore></ignore>
                      </action>
                  </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
        <executions>
          <execution>
            <goals>
              <goal>toolchain</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <toolchains>
            <jdk>
              <version>1.6</version>
              <vendor>sun</vendor>
            </jdk>
          </toolchains>
        </configuration>
    </plugin>

and my toolchains.xml

<?xml version="1.0" encoding="UTF8"?>
<toolchains>
  <!-- JDK toolchains -->
  <toolchain>
    <type>jdk</type>
    <provides>
      <version>1.6</version>
      <vendor>sun</vendor>
    </provides>
    <configuration>
      <jdkHome>D:\POC\jdk1.6.0_31</jdkHome>
    </configuration>
  </toolchain>

</toolchains>

Solution

  • The error got resolved after changing my pom.xml file like below. We need to add the maven life cycle plugin and then include the metadata information in the .

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.6</version>
            </plugin>
            <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-toolchains-plugin</artifactId>
                    <version>1.1</version>
                    <executions>
                      <execution>
                        <goals>
                          <goal>toolchain</goal>
                        </goals>
                      </execution>
                    </executions>
                    <configuration>
                      <toolchains>
                        <jdk>
                          <version>1.6</version>
                          <vendor>sun</vendor>
                        </jdk>
                      </toolchains>
                    </configuration>
                </plugin>
        </plugins>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.eclipse.m2e</groupId>
              <artifactId>lifecycle-mapping</artifactId>
              <version>1.0.0</version>
              <configuration>
              <lifecycleMappingMetadata>
                   <pluginExecutions>
                      <pluginExecution>
                          <pluginExecutionFilter>
                              <groupId>
                                  org.apache.maven.plugins
                              </groupId>
                              <artifactId>
                                  maven-toolchains-plugin
                              </artifactId>
                              <versionRange>
                                  [1.1,)
                              </versionRange>
                              <goals>
                                  <goal>toolchain</goal>
                              </goals>
                          </pluginExecutionFilter>
                          <action>
                              <ignore></ignore>
                          </action>
                      </pluginExecution>
                  </pluginExecutions>
                </lifecycleMappingMetadata>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>