Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

m2eclipse error

I am developing a web application with Eclipse and I generate the project with a maven archetype.

When I enable maven dependency management, Eclipse mark some errors in the pom file, this error is:

 Multiple annotations found at this line: - Execution default-testResources of goal org.apache.maven.plugins:maven-resources-          plugin:2.4.3:testResources failed:   Plugin org.apache.maven.plugins:maven-resources-plugin:2.4.3 or one of its dependencies could not be resolved: Failed to collect   dependencies for org.apache.maven.plugins:maven-resources-plugin:jar:2.4.3 () (org.apache.maven.plugins:maven-resources-  plugin:2.4.3:testResources:default-testResources:process-test-resources) - Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile   (execution: default-compile, phase: compile) - CoreException: Could not get the value for parameter compilerId for plugin execution default-compile:   PluginResolutionException: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.3.2 or one of its dependencies could not be   resolved: Failed to collect dependencies for org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2 ():   ArtifactDescriptorException: Failed to read artifact descriptor for org.apache.maven:maven-plugin-api:jar:2.0.6:   ArtifactResolutionException: Failure to transfer org.apache.maven:maven-plugin-api:pom:2.0.6 from http://repo1.maven.org/  maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or   updates are forced. Original error: Could not transfer artifact org.apache.maven:maven-plugin-api:pom:2.0.6 from/to central (http://  repo1.maven.org/maven2): null to http://repo1.maven.org/maven2/org/apache/maven/maven-plugin-api/2.0.6/maven-plugin-  api-2.0.6.pom - CoreException: Could not get the value for parameter compilerId for plugin execution default-testCompile:   PluginResolutionException: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.3.2 or one of its dependencies could not be   resolved: Failed to collect dependencies for org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2 ():   ArtifactDescriptorException: Failed to read artifact descriptor for org.apache.maven:maven-plugin-api:jar:2.0.6:   ArtifactResolutionException: Failure to transfer org.apache.maven:maven-plugin-api:pom:2.0.6 from http://repo1.maven.org/  maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or   updates are forced. Original error: Could not transfer artifact org.apache.maven:maven-plugin-api:pom:2.0.6 from/to central (http://  repo1.maven.org/maven2): null to http://repo1.maven.org/maven2/org/apache/maven/maven-plugin-api/2.0.6/maven-plugin-  api-2.0.6.pom - Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:2.4.3:resources failed: Plugin   org.apache.maven.plugins:maven-resources-plugin:2.4.3 or one of its dependencies could not be resolved: Failed to collect   dependencies for org.apache.maven.plugins:maven-resources-plugin:jar:2.4.3 () (org.apache.maven.plugins:maven-resources-  plugin:2.4.3:resources:default-resources: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) 

My pom file is the following:

<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.lala.sarasa</groupId>    <artifactId>msrdecision</artifactId>   <packaging>war</packaging>   <version>1.0-SNAPSHOT</version>   <name>msrdecision 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>   </dependencies>   <build>     <finalName>hello</finalName>    </build>  </project> 

Any idea?

like image 927
McSas Avatar asked Jan 12 '12 12:01

McSas


People also ask

How do I uninstall m2eclipse plugin?

Run Help > About Eclipse > Installation Details, select the software you no longer want and click Uninstall.


2 Answers

I had same problem with Eclipse 3.7.2 (Indigo) and maven 3.0.4.

In my case, the problem was caused by missing maven-resources-plugin-2.4.3.jar in {user.home}\.m2\repository\org\apache\maven\plugins\maven-resources-plugin\2.4.3 folder. (no idea why maven didn't update it)

Solution:

1.) add dependency to pom.xml

<dependency>     <groupId>org.apache.maven.plugins</groupId>     <artifactId>maven-resources-plugin</artifactId>     <version>2.4.3</version> </dependency> 

2.) run mvn install from Eclipse or from command line

3.) refresh the project in eclipse (F5)

4.) run Maven > Update Project Configuration... on project (right click)

JAR file is downloaded to local repository and there are no errors in WS.

like image 148
Betlista Avatar answered Sep 26 '22 11:09

Betlista


I also had same problem with Eclipse 3.7.2 (Indigo) and maven 3.0.4.

Eclipse wasn't picking up my maven settings, so this is what I did to fix the problem:

  1. Window - Preferences - Maven - Installations

    • Add (Maven 3.0.4 instead of using Embedded)
    • Click Apply & OK
  2. Maven > Update Project Configuration... on project (right click)

  3. Shutdown Eclipse

  4. Run mvn install from the command line.

  5. Open Eclipse

Those steps worked for me, but the problem isn't consistent. I've only had with issue on one computer.

like image 29
Kyght Avatar answered Sep 23 '22 11:09

Kyght