Plugin execution not covered by lifecycle configur

2019-07-22 05:18发布

问题:

Beginner of Spring

Background : So far, i have been working on core JAVA and now i need to switch to MVC
Trying to make my first Spring MVC Hello World Example from this tutorial , i am getting below error on pom.xml:

Multiple annotations found at this line:
    - Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:
     2.3.2:compile (execution: default-compile, phase: compile)
    - Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-resources-plugin:
     2.5:testResources (execution: default-testResources, phase: process-test-resources)
    - <packaging>war</packaging>
    - Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-resources-plugin:
     2.5:resources (execution: default-resources, phase: process-resources)
    - Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:
     2.3.2:testCompile (execution: default-testCompile, phase: test-compile)

Error is generated on this line of pom.xml :

  <packaging>war</packaging>

pom.xml

<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/maven-v4_0_0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>com.javacodegeeks.snippets.enterprise</groupId>
      <artifactId>springexample</artifactId>
      <packaging>war</packaging>
      <version>0.0.1-SNAPSHOT</version>
      <name>springexample Maven Webapp</name>
      <url>http://maven.apache.org</url>
      <dependencies>
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>3.8.1</version>
          <scope>test</scope>
        </dependency>

        <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-core</artifactId>
                <version>${spring.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-webmvc</artifactId>
                <version>${spring.version}</version>
            </dependency>
      </dependencies>
      <build>
        <finalName>springexample</finalName>
      </build>

        <properties>
            <spring.version>4.0.2.RELEASE</spring.version>
        </properties>
</project>

I even installed m2e after searching in marketplace

Please go easy, this question comes in as an attempt to learn something totally new to me.
Do i need some plugin or something to resolve this? If so, is there any universal kind of plugin to avoid any such future error?
IDE : Eclipse Kepler

P.S :

I have already browsed old threads but no luck :

  • How to solve "Plugin execution not covered by lifecycle configuration" for Spring Data Maven Builds

  • Plugin execution not covered by lifecycle configuration error in eclipse with pluginManagement in parent pom

回答1:

The problem is that m2e requires one eclipse plugin for each maven plugin that you use (it's actually a bit more complex than that, but in practice, there is an almost one to one correspondence between Eclipse plugins and maven plugins for your project).

There are two solutions:

  1. Use the maven-eclipse plugin to automatically generate all of your eclipse project files. From the command line, run mvn eclipse:eclipse to do this. You should also uninstall m2e so that it doesn't try to manage your maven project.
  2. Install Spring-Ide. I'd recommend going with a fresh installation, but you can also install it into an existing instance of Eclipse. This comes pre-installed with all of the m2e plugins that you will need.


回答2:

That is no reason to stop using m2e, you can fix those errors by simply right-clicking them and using Quick Fix command. You will have the option to search for available lifecycle configurators in Marketplace to automatically handle it or, if there is none, you could tell m2e to ignore the plugin.