69

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?

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
McSas
  • 2,224
  • 3
  • 27
  • 42
  • The errors hint that maven can't reach a remote repository. Does "mvn clean package" work on the console? – KarlsFriend Jan 12 '12 at 12:33
  • 1
    my coworkers that use Windows are with same problem. I'm using ubuntu, same version of maven and eclipse, same project... and everything works fine... – caarlos0 Apr 24 '12 at 18:04
  • In my case it was solved with just mvn clean install -U – Albert Hendriks Oct 20 '15 at 09:58
  • 1
    could happen if the required plugin has **different version than the one in maven repository**, like in a case when restoring an old project which one of it's maven plugins has an earlier version. Updating to correct version number of the installed plugin, would fix it, if that's the case. – Noam Manos May 18 '16 at 20:19

17 Answers17

74

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.

Betlista
  • 10,327
  • 13
  • 69
  • 110
  • did you checked that there is `org\apache\maven\plugins\maven-resources-plugin\2.4.3` in repository ? – Betlista Apr 24 '12 at 19:32
  • yep, 2.3, 2.4.3 and 2.5. Actually, after a lot of refreshes, mvn install eclipse:eclipse, cleans, close and reopen eclipse, it finally seem to work... but, it become with another error: "Unknow error". any idea? – caarlos0 Apr 24 '12 at 20:14
35

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.

sri
  • 27
  • 6
Kyght
  • 617
  • 7
  • 8
29

Just go to your user folder, inside it there's a ".m2" folder, open it and delete the folder "repository". Go to eclipse, clean your project, then right click->Maven->Update Project .. and you are ready to go.

Kalaji
  • 756
  • 7
  • 10
13

I solved this by running mvn -U install from command line and then "Maven->Update Project" from Eclipse

altumano
  • 2,676
  • 2
  • 26
  • 20
  • 1
    I had to first edit the pom.xml file to add the dependency on the module that was causing the problem (org.apache.maven.plugins:maven-jar-plugin, in my case), then OUTSIDE OF ECLIPSE run mvn clean and then mvn -U install in the project folder. Then I restarted eclipse and did a clean/build on the project and All Was Well. – Redboots Apr 23 '13 at 12:44
10

In this particular case, the solution was the right proxy configuration of eclipse (Window -> Preferences -> Network Connection), the company possessed a strict security system. I will leave the question, because there are answers that can help the community. Thank you very much for the answers above.

McSas
  • 2,224
  • 3
  • 27
  • 42
4

In my case the problem was solved by Window -> Preferences -> Maven -> User Settings -> Update Settings. I don't know the problem cause at the first place.

mohaseeb
  • 389
  • 4
  • 8
2

This what helped me:

  1. Delete the project from eclipse (but don't delete from disk)
  2. Close eclipse
  3. In your user folder there is .m folder. Delete repository folder underneath it (.m/repository).
  4. Open eclipse
  5. Import project as existing maven project (from disk).

Good luck.

eebbesen
  • 5,070
  • 8
  • 48
  • 70
KerenSi
  • 389
  • 7
  • 20
1

I would add some points that helped me to solve this problem :

Having the local repository OK, on the other hand, turned out to be quite costly, as many archetypes would not get loaded, due apparently to timeouts of m2eclipse and very unstable communication speeds in my case.

In many cases only the error file could be found in the folder ex : xxx.jar.lastUpdated, instead of the jar or pom file. I had always to suppress this file to permit a new download.

Also really worthy were :

  • as already said, using the mvn clean install from the command line, apparently much more patient than m2eclipse, and also efficient and verbose, at least for the time being.

  • (and also the Update Project of the Maven menu)

  • downloading using the dependency:get goal

    mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:get -DrepoUrl=url -Dartifact=groupId:artifactId:version1

(from within the project folder) (hint given in another thread, thanks also).

  • also downloading and installing manually (.jar+.sha1), from in particular, "m2proxy atlassian" .

  • adding other repositories in the pom.xml itself (the settings.xml mirror configuration did'nt do the job, I don't know yet why). Ex : nexus/content/repositories/releases/ et nexus/content/repositories/releases/, sous repository.jboss.org, ou download.java.net/maven/2 .

To finish, in any case, a lot of time (!..) could have been et could certainly still be spared with a light tool repairing thoroughly the local repository straightaway. I could not yet find it. Actually it should even be normally a mvn command ("--repair-local-repository").

Krishnachandra Sharma
  • 1,332
  • 2
  • 20
  • 42
1

Encountered the same problem. For my case i was working behind a proxy.

My solution was

  1. Modify the settings.xml file in the .m2 folder to add the proxy configuration.

    proxy true http 172.23.182.63 4145

  2. In eclipse Click update settings button. Menu: Windows>>Preferences>>Maven>>User Settings

  3. Delete the .m2/repository folder
  4. Refresh my maven project.

After step 4 - eclipse took a few minutes downloading files and project refreshed successfully.

steve biko
  • 171
  • 5
  • Step 2 was the key for me... I had modified the settings.xml file under the maven install, but had not directed Eclipse to use it. Step 3 wasn't relevent, but 4 worked perfectly. – Jeff W Nov 01 '16 at 02:26
0

This error bothered me for two days. I tried all kinds of solutions, nothing worked. Finally I give up and tried a radical approach. and it worked! Here are the steps:

  1. Save a copy of the pom.xml,
  2. deleted all text in pom.xml
  3. Let eclipse do a clean rebuild, of course everything will be broken.
  4. pasted back everything in the original pom.xml
  5. let Eclipse build again

I guess it was "indeterministic" as the following article said.

http://wiki.eclipse.org/M2E_plugin_execution_not_covered

hli
  • 11
  • 1
  • 1
  • 3
0

in my case there was a dependency without a version. in eclipse m2e does not force you to enter a version so i left it blank. once i put the version in pom.xml from within eclipse all was fine

necromancer
  • 23,916
  • 22
  • 68
  • 115
0

I had a similar case for the default groovy compiler plugin

The solution was to install ME2 provided by Springsource according to this answer

Plugin execution not covered by lifecycle configuration maven error

This immediately solved the "Plugin execution not covered by lifecycle configuration" problem in Eclispe Juno.

Community
  • 1
  • 1
simou
  • 2,467
  • 4
  • 30
  • 39
0

I had the same problem but with an other cause. The solution was to deactivate Avira Browser Protection (in german Browser-Schutz). I took the solusion from m2e cannot transfer metadata from nexus, but maven command line can. It can be activated again ones maven has the needed plugin.

Community
  • 1
  • 1
iuzuz
  • 69
  • 6
0

I am using MacOSX with Eclipse 4.3 (Krepler). What I originally tried was to install Maven via the terminal using Brew. It installed correctly Maven 3.0.4. However when I tried to import any ready maven projects (File > Import > Maven) it would display the following two errors:

No marketplace entries found to handle Execution default-testResources

What I did is go to Help > Eclipse Marketplace and type "Maven" in the search bar and install the first default Maven client for Eclipse. Everything worked for me from this point.

Hope it helps to you too.

Placeholder
  • 4,651
  • 6
  • 33
  • 35
0

The following steps worked for me:

  1. Close Eclipse.
  2. Navigate to user home directory. (For example: "C:\Users\YourUserName.m2")
  3. Delete the "repository" folder.
  4. Re-open Eclipse.
  5. Click on the Maven project that has an issue and go to "Project" --> "Clean".
  6. Right-click on the project and go to "Maven" --> "Update Project...".
  7. Close Eclipse.
  8. Open Eclipse.
  9. Click on the project folder in the "Project Explorer" window (usually on the left).
  10. Hit the "F5" key a few times to Refresh your project.
  11. Done! These steps worked for me in Eclipse Luna. Please let me know if I can help further.
specialk1st
  • 1,717
  • 21
  • 20
0

My issue was that eclipse could not find the mvn.bat file within the installation directory. The solution is to create a mvn.bat file with the following code:

"%~dp0\mvn.cmd" %*

Save that file. Place it inside the [Maven Installation Folder]\bin directory.

Zach Pedigo
  • 396
  • 2
  • 9
0

It must be a configuration problem. Your pom is fine.

Here's what I did. New folder, put your pom inside. Then in eclipse: import -> maven -> existing maven project. Dependencies got included in the project.

I did this using eclipse helios. I think the plugin version I am using is 0.12

You should check the maven properties in eclipse.

kd8azz
  • 613
  • 5
  • 21
KarlsFriend
  • 745
  • 1
  • 4
  • 17
  • where are the maven properties in eclipse? – McSas Jan 12 '12 at 12:32
  • I tried to put the pom file in a new folder. When I try to import the project eclipse show two erros: * No marketplace entries found to handle maven-compiler-plugin:2.3.2:testCompile in Eclipse. and * No marketplace entries found to handle maven-compiler-plugin:2.3.2:compile in Eclipse. // any idea? – McSas Jan 12 '12 at 12:38