4

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 :

Community
  • 1
  • 1
NoobEditor
  • 15,563
  • 19
  • 81
  • 112

2 Answers2

6

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.

Diego V
  • 6,189
  • 7
  • 40
  • 45
2

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.
Andrew Eisenberg
  • 28,387
  • 9
  • 92
  • 148
  • do i need to uninstall `m2e` first then run `mvn eclipse:eclipse`? – NoobEditor May 11 '14 at 16:07
  • 1
    It's easiest to do it through inside the IDE. Help -> About Eclipse -> Installed Software -> (Select m2e) -> Uninstall... – Andrew Eisenberg May 11 '14 at 16:08
  • There is a command line way to do this. See the p2 director application (already installed with your Eclipse): http://wiki.eclipse.org/Equinox/p2/Director_application – Andrew Eisenberg May 11 '14 at 16:08
  • And, no, you don't *need* to uninstall m2e at all. It's just that I've seen m2e get confused when it is combined with maven Eclipse plugin. YMMV. – Andrew Eisenberg May 11 '14 at 16:10
  • awesome...POM error is solved, but my project still shows that little *red cross mark* on the main project name, though any subfolder is not showing it....any thoughts on that too? – NoobEditor May 11 '14 at 16:16
  • That might be left over from when it was an m2e project. In the problems view, right-click on the problem and select delete. If the problem comes back, you will need to edit the .project file (hidden by default) and remove and references to maven and m2e. – Andrew Eisenberg May 11 '14 at 19:00
  • How to fix this issue in STS – Ananthu K Kumar Mar 08 '22 at 09:20