eclipse m2eclipse 错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8834806/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 20:49:54  来源:igfitidea点击:

m2eclipse error

eclipsemavenm2eclipse

提问by McSas

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

我正在使用 Eclipse 开发 Web 应用程序,并使用 maven 原型生成项目。

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

当我启用maven依赖管理时,Eclipse在pom文件中标记了一些错误,这个错误是:

 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:

我的pom文件如下:

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

任何的想法?

采纳答案by McSas

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.

在这种特殊情况下,解决方案是 eclipse 的正确代理配置(窗口 -> 首选项 -> 网络连接),该公司拥有严格的安全系统。我会留下这个问题,因为有些答案可以帮助社区。非常感谢以上的回答。

回答by Betlista

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

我在 Eclipse 3.7.2 (Indigo) 和 maven 3.0.4 上遇到了同样的问题。

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

对我来说,这个问题是由缺少造成maven-resources-plugin-2.4.3.jar{user.home}\.m2\repository\org\apache\maven\plugins\maven-resources-plugin\2.4.3文件夹中。(不知道为什么 maven 没有更新它)

Solution:

解决方案:

1.) add dependency to pom.xml

1.) 给 pom.xml 添加依赖

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

2.) run mvn installfrom Eclipse or from command line

2.)mvn install从 Eclipse 或命令行运行

3.) refresh the project in eclipse (F5)

3.) 在eclipse中刷新项目(F5)

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

4.)Maven > Update Project Configuration...在项目上运行(右键单击)

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

JAR 文件下载到本地存储库,WS 中没有错误。

回答by Kyght

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

我在 Eclipse 3.7.2 (Indigo) 和 maven 3.0.4 上也有同样的问题。

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

Eclipse 没有选择我的 Maven 设置,所以这是我为解决问题所做的:

  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. ShutdownEclipse

  4. Runmvn installfrom the command line.

  5. OpenEclipse

  1. 窗口 - 首选项 - Maven - 安装

    • 添加(Maven 3.0.4 而不是使用 Embedded)
    • 单击应用并确定
  2. Maven >更新项目配置... 在项目上(右键单击)

  3. 关闭Eclipse

  4. 运行mvn install命令行。

  5. 打开日食

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

这些步骤对我有用,但问题并不一致。我只在一台计算机上遇到过问题。

回答by Kalaji

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.

只需转到您的用户文件夹,里面有一个“.m2”文件夹,打开它并删除文件夹“repository”。转到 eclipse,清理您的项目,然后右键单击->Maven->Update Project .. 就可以开始了。

回答by altumano

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

我通过mvn -U install从命令行运行然后从 Eclipse运行“Maven->更新项目”解决了这个问题

回答by mohaseeb

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.

在我的情况下,问题是通过 Window -> Preferences -> Maven -> User Settings -> Update Settings 解决的。我一开始不知道问题的原因。

回答by KerenSi

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 .mfolder. Delete repositoryfolder underneath it (.m/repository).
  4. Open eclipse
  5. Import project as existing maven project (from disk).
  1. 从 eclipse 中删除项目(但不要从磁盘中删除)
  2. 关闭日食
  3. 在您的用户文件夹中有.m文件夹。删除repository它下面的文件夹(.m/repository)。
  4. 打开日食
  5. 将项目作为现有 Maven 项目(从磁盘)导入。

Good luck.

祝你好运。

回答by steve biko

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.
  1. 修改.m2文件夹下的settings.xml文件,添加代理配置。

    代理真正的 http 172.23.182.63 4145

  2. 在 Eclipse 中单击更新设置按钮。菜单:Windows>>首选项>>Maven>>用户设置

  3. 删除 .m2/repository 文件夹
  4. 刷新我的 Maven 项目。

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

在第 4 步之后 - eclipse 花了几分钟下载文件并成功刷新项目。

回答by Laurent Chrétien

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.

另一方面,拥有本地存储库OK 的成本非常高,因为许多原型无法加载,这显然是由于 m2eclipse 超时和在我的情况下非常不稳定的通信速度。

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.

在许多情况下,只能在文件夹 ex : 中找到错误文件xxx.jar.lastUpdated,而不是 jar 或 pom 文件。我总是禁止这个文件以允许新的下载。

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

  • 如前所述,从命令行使用 mvn clean install,显然比 m2eclipse 更有耐心,而且效率和冗长,至少目前是这样。

  • (还有 Maven 菜单的更新项目)

  • 使用依赖项下载:获取目标

    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 .

  • 还可以手动下载和安装 (.jar+.sha1),特别是从 "m2proxy atlassian" 。

  • 在 pom.xml 本身中添加其他存储库(settings.xml 镜像配置没有完成这项工作,我还不知道为什么)。例如: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").

最后,在任何情况下,使用轻量级工具彻底修复本地存储库可以节省大量时间(!..)。我还没有找到。实际上它甚至应该通常是一个 mvn 命令(“--repair-local-repository”)。

回答by hli

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
  1. 保存一份 pom.xml,
  2. 删除了 pom.xml 中的所有文本
  3. 让eclipse做一个干净的重建,当然一切都会被破坏。
  4. 粘贴回原始 pom.xml 中的所有内容
  5. 让 Eclipse 再次构建

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

我想这是“不确定的”,正如下面的文章所说。

http://wiki.eclipse.org/M2E_plugin_execution_not_covered

http://wiki.eclipse.org/M2E_plugin_execution_not_covered