生命周期配置未涵盖插件执行


问题内容

春天的初学者

背景: 到目前为止,我一直在研究核心JAVA,现在我需要切换到MVC
尝试 从本教程 制作我的第一个Spring MVC HelloWorld示例 ,但出现以下错误: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)

在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>

m2e市场上搜索后甚至安装了

请放轻松,这个问题的出现是为了尝试学习对我来说是全新的东西。
我需要一些插件或其他解决方案吗?如果是这样,是否有 通用 的插件可以避免此类将来的错误?
IDE: Eclipse开普勒


问题答案:

问题在于,对于您使用的每个maven插件,m2e都需要一个eclipse插件(实际上比这要复杂一些,但实际上,您的项目的Eclipse插件和maven插件之间几乎是一对一的对应关系)。

有两种解决方案:

  1. 使用maven-eclipse插件自动生成所有的eclipse项目文件。从命令行运行mvn eclipse:eclipse以执行此操作。您还应该卸载m2e,以便它不会尝试管理您的maven项目。
  2. 安装Spring-Ide。我建议进行全新安装,但您也可以将其安装到Eclipse的现有实例中。它已经预安装了您需要的所有m2e插件。