简体   繁体   English

m2eclipse 错误

[英]m2eclipse error

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?任何的想法?

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.jar in {user.home}\\.m2\\repository\\org\\apache\\maven\\plugins\\maven-resources-plugin\\2.4.3 folder.就我而言,问题是由于{user.home}\\.m2\\repository\\org\\apache\\maven\\plugins\\maven-resources-plugin\\2.4.3缺少maven-resources-plugin-2.4.3.jar引起的文件夹。 (no idea why maven didn't update it) (不知道为什么 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 install from Eclipse or from command line 2.) 从 Eclipse 或命令行运行mvn install

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 中没有错误。

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窗口 - 首选项 - Maven - 安装

    • Add (Maven 3.0.4 instead of using Embedded)添加(Maven 3.0.4 而不是使用 Embedded)
    • Click Apply & OK单击应用并确定
  2. Maven > Update Project Configuration ... on project (right click) Maven >更新项目配置... 在项目上(右键单击)

  3. Shutdown Eclipse关闭Eclipse

  4. Run mvn install from the command line.从命令行运行mvn install

  5. Open Eclipse打开日食

Those steps worked for me, but the problem isn't consistent.这些步骤对我有用,但问题并不一致。 I've only had with issue on one computer.我只在一台计算机上遇到过问题。

Just go to your user folder, inside it there's a ".m2" folder, open it and delete the folder "repository".只需转到您的用户文件夹,里面有一个“.m2”文件夹,打开它并删除文件夹“repository”。 Go to eclipse, clean your project, then right click->Maven->Update Project .. and you are ready to go.转到 eclipse,清理您的项目,然后右键单击->Maven->Update Project .. 就可以开始了。

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

In this particular case, the solution was the right proxy configuration of eclipse (Window -> Preferences -> Network Connection), the company possessed a strict security system.在这种特殊情况下,解决方案是 eclipse 的正确代理配置(窗口 -> 首选项 -> 网络连接),该公司拥有严格的安全系统。 I will leave the question, because there are answers that can help the community.我会留下这个问题,因为有些答案可以帮助社区。 Thank you very much for the answers above.非常感谢以上的回答。

In my case the problem was solved by Window -> Preferences -> Maven -> User Settings -> Update Settings.在我的情况下,问题是通过 Window -> Preferences -> Maven -> User Settings -> Update Settings 解决的。 I don't know the problem cause at the first place.我一开始不知道问题的原因。

This what helped me:这对我有帮助:

  1. Delete the project from eclipse (but don't delete from disk)从 eclipse 中删除项目(但不要从磁盘中删除)
  2. Close eclipse关闭日食
  3. In your user folder there is .m folder.在您的用户文件夹中有.m文件夹。 Delete repository folder underneath it (.m/repository).删除它下面的repository文件夹 (.m/repository)。
  4. Open eclipse打开日食
  5. Import project as existing maven project (from disk).将项目作为现有 Maven 项目(从磁盘)导入。

Good luck.祝你好运。

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.在许多情况下,只能在文件夹 ex 中找到错误文件: xxx.jar.lastUpdated ,而不是 jar 或 pom 文件。 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.如前所述,从命令行使用 mvn clean install,显然比 m2eclipse 更有耐心,而且效率和冗长,至少目前是这样。

  • (and also the Update Project of the Maven menu) (还有 Maven 菜单的更新项目)

  • downloading using the dependency:get goal使用依赖项下载:获取目标

    mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:get -DrepoUrl=url -Dartifact=groupId:artifactId:version1 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" .还可以手动下载和安装 (.jar+.sha1),特别是从 "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).在 pom.xml 本身中添加其他存储库(settings.xml 镜像配置没有完成这项工作,我还不知道为什么)。 Ex : nexus/content/repositories/releases/ et nexus/content/repositories/releases/, sous repository.jboss.org, ou download.java.net/maven/2 .例如: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”)。

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

    proxy true http 172.23.182.63 4145代理真正的 http 172.23.182.63 4145

  2. In eclipse Click update settings button.在 Eclipse 中单击更新设置按钮。 Menu: Windows>>Preferences>>Maven>>User Settings菜单:Windows>>首选项>>Maven>>用户设置

  3. Delete the .m2/repository folder删除 .m2/repository 文件夹
  4. Refresh my maven project.刷新我的 Maven 项目。

After step 4 - eclipse took a few minutes downloading files and project refreshed successfully.在第 4 步之后 - eclipse 花了几分钟下载文件并成功刷新项目。

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,保存一份 pom.xml,
  2. deleted all text in pom.xml删除了 pom.xml 中的所有文本
  3. Let eclipse do a clean rebuild, of course everything will be broken.让eclipse做一个干净的重建,当然一切都会被破坏。
  4. pasted back everything in the original pom.xml粘贴回原始 pom.xml 中的所有内容
  5. let Eclipse build again让 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

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.在 Eclipse 中,m2e 不会强制您输入版本,因此我将其留空。 once i put the version in pom.xml from within eclipse all was fine一旦我将版本放在 eclipse 中的 pom.xml 中,一切都很好

I had a similar case for the default groovy compiler plugin对于默认的 groovy 编译器插件,我有一个类似的案例

The solution was to install ME2 provided by Springsource according to this answer解决方案是根据这个答案安装Springsource提供的ME2

Plugin execution not covered by lifecycle configuration maven error 生命周期配置 maven 错误未涵盖插件执行

This immediately solved the "Plugin execution not covered by lifecycle configuration" problem in Eclispe Juno.这立即解决了 Eclispe Juno 中“生命周期配置未涵盖插件执行”的问题。

I had the same problem but with an other cause.我有同样的问题,但有其他原因。 The solution was to deactivate Avira Browser Protection (in german Browser-Schutz).解决方案是停用 Avira 浏览器保护(德语版 Browser-Schutz)。 I took the solusion from m2e cannot transfer metadata from nexus, but maven command line can .我从 m2e 中解决了无法从 nexus 传输元数据的问题,但是 maven 命令行可以 It can be activated again ones maven has the needed plugin. Maven 有需要的插件可以再次激活它。

I am using MacOSX with Eclipse 4.3 (Krepler).我在 Eclipse 4.3 (Krepler) 上使用 MacOSX。 What I originally tried was to install Maven via the terminal using Brew.我最初尝试的是使用 Brew 通过终端安装 Maven。 It installed correctly Maven 3.0.4.它正确安装了 Maven 3.0.4。 However when I tried to import any ready maven projects (File > Import > Maven) it would display the following two errors:但是,当我尝试导入任何准备好的 Maven 项目(文件 > 导入 > Maven)时,它会显示以下两个错误:

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.我所做的是转到 Help > Eclipse Marketplace 并在搜索栏中键入“Maven”并为 Eclipse 安装第一个默认 Maven 客户端。 Everything worked for me from this point.从这一点开始,一切都对我有用。

Hope it helps to you too.希望对你也有帮助。

The following steps worked for me:以下步骤对我有用:

  1. Close Eclipse.关闭日食。
  2. Navigate to user home directory.导航到用户主目录。 (For example: "C:\\Users\\YourUserName.m2") (例如:“C:\\Users\\YourUserName.m2”)
  3. Delete the "repository" folder.删除“存储库”文件夹。
  4. Re-open Eclipse.重新打开 Eclipse。
  5. Click on the Maven project that has an issue and go to "Project" --> "Clean".单击有问题的 Maven 项目,然后转到“项目”-->“清理”。
  6. Right-click on the project and go to "Maven" --> "Update Project...".右键单击项目并转到“Maven”-->“更新项目...”。
  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.按几次“F5”键以刷新您的项目。
  11. Done!完毕! These steps worked for me in Eclipse Luna.这些步骤在 Eclipse Luna 中对我有用。 Please let me know if I can help further.如果我能提供进一步帮助,请告诉我。

My issue was that eclipse could not find the mvn.bat file within the installation directory.我的问题是 eclipse 在安装目录中找不到 mvn.bat 文件。 The solution is to create a mvn.bat file with the following code:解决方法是使用以下代码创建一个 mvn.bat 文件:

"%~dp0\mvn.cmd" %*

Save that file.保存那个文件。 Place it inside the [Maven Installation Folder]\\bin directory.将它放在[Maven 安装文件夹]\\bin 目录中。

It must be a configuration problem.应该是配置问题。 Your pom is fine.你的pom很好。

Here's what I did.这就是我所做的。 New folder, put your pom inside.新建文件夹,把你的pom放在里面。 Then in eclipse: import -> maven -> existing maven project.然后在 Eclipse 中:导入 -> maven -> 现有的 maven 项目。 Dependencies got included in the project.项目中包含了依赖项。

I did this using eclipse helios.我使用eclipse helios做到了这一点。 I think the plugin version I am using is 0.12认为我使用的插件版本是 0.12

You should check the maven properties in eclipse.您应该检查 eclipse 中的 maven 属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM