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

时间:2014-05-11 14:16:36

标签: spring maven spring-mvc pom.xml eclipse-kepler

春天的初学者

背景:到目前为止,我一直致力于核心JAVA,现在我需要切换到MVC 试图制作我的第一个Spring MVC Hello World示例 from this tutorial ,我在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>

我在 marketplace

中搜索后甚至安装了m2e

请放轻松,这个问题是为了尝试学习一些全新的东西。
我需要一些插件或其他东西来解决这个问题吗?如果是这样,是否有任何通用类型的插件可以避免任何此类未来错误?
IDE: Eclipse Kepler

P.S:

我已经浏览了旧线程,但没有运气:

2 个答案:

答案 0 :(得分:4)

没有理由停止使用m2e,只需右键单击并使用 Quick Fix 命令即可修复这些错误。您可以选择在Marketplace中搜索可用的生命周期配置程序以自动处理它,如果没有,您可以告诉m2e忽略该插件。

答案 1 :(得分:1)

问题是m2e需要为你使用的每个maven插件提供一个eclipse插件(它实际上比这复杂一点,但实际上,Eclipse插件和maven插件之间几乎有一对一的对应关系)。

有两种解决方案:

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