m2eclipse错误

发布于 2024-12-26 06:31:40 字数 4392 浏览 5 评论 0原文

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

当我启用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)

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(17

宁愿没拥抱 2025-01-02 06:31:41

我正在使用 MacOSX 和 Eclipse 4.3 (Krepler)。我最初尝试的是使用 Brew 通过终端安装 Maven。它正确安装了 Maven 3.0.4。但是,当我尝试导入任何准备好的 Maven 项目(文件 > 导入 > Maven)时,它会显示以下两个错误:

没有找到处理执行default-testResources的市场条目

我所做的是转到“帮助”>“ Eclipse Marketplace 并在搜索栏中输入“Maven”,然后安装 Eclipse 的第一个默认 Maven 客户端。从此时起,一切都对我有用。

希望它也对你有帮助。

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.

朦胧时间 2025-01-02 06:31:41

以下步骤对我有用:

  1. 关闭 Eclipse。
  2. 导航到用户主目录。 (例如:“C:\Users\YourUserName.m2”)
  3. 删除“repository”文件夹。
  4. 重新打开 Eclipse。
  5. 点击有问题的Maven项目,进入“Project”--> “干净的”。
  6. 右键单击该项目并转到“Maven”--> “更新项目...”。
  7. 关闭日食。
  8. 打开 Eclipse。
  9. 单击“Project Explorer”窗口(通常在左侧)中的项目文件夹。
  10. 按几次“F5”键刷新您的项目。
  11. 完毕!
    这些步骤在 Eclipse Luna 中对我有用。如果我可以提供进一步的帮助,请告诉我。

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.
巨坚强 2025-01-02 06:31:41

我的问题是 eclipse 在安装目录中找不到 mvn.bat 文件。解决方案是使用以下代码创建 mvn.bat 文件:

"%~dp0\mvn.cmd" %*

保存该文件。将其放在[Maven 安装文件夹]\bin 目录中。

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.

稳稳的幸福 2025-01-02 06:31:40

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

就我而言,问题是由于 {user.home}\.m2\repository\org\apache\maven\plugins 中缺少 maven-resources-plugin-2.4.3.jar 引起的\maven-resources-plugin\2.4.3 文件夹。 (不知道为什么 maven 没有更新它)

解决方案:

1.) 添加对 pom.xml 的依赖项

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

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

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

4.) 运行 Maven >更新项目配置... 项目(右键单击)

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

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.

幽蝶幻影 2025-01-02 06:31:40

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

Eclipse 没有获取我的 Maven 设置,所以我这样做是为了解决问题:

  1. Window - Preferences - Maven - Installations

    • 添加(Maven 3.0.4 而不是使用嵌入式)
    • 单击“应用”并单击“好的
  2. Maven> 更新项目配置...在项目上(右键单击)

  3. 关闭 Eclipse

  4. 从命令行运行 mvn install

  5. 打开 Eclipse

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

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.

勿忘初心 2025-01-02 06:31:40

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

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.

青巷忧颜 2025-01-02 06:31:40

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

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

寄风 2025-01-02 06:31:40

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

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.

累赘 2025-01-02 06:31:40

就我而言,问题是通过 Window -> 解决的首选项-> Maven->用户设置->更新设置。我一开始并不知道问题的原因。

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.

客…行舟 2025-01-02 06:31:40

这对我有帮助:

  1. 从 eclipse 中删除项目(但不要从磁盘中删除)
  2. 关闭 eclipse
  3. 在您的用户文件夹中有 .m 文件夹。删除其下面的 repository 文件夹 (.m/repository)。
  4. 打开 eclipse
  5. 将项目导入为现有 Maven 项目(从磁盘)。

祝你好运。

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.

情深缘浅 2025-01-02 06:31:40

我想添加一些帮助我解决这个问题的要点:

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

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

另外真正值得的是:

  • 正如已经说过的,从命令行使用 mvn clean install,显然比 m2eclipse 更有耐心,而且也高效且冗长,至少目前是这样。

  • (以及Maven菜单的Update Project)

  • 使用dependency:get goal下载

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

(来自项目文件夹内)(在另一个线程中给出的提示,也谢谢)。

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

  • 在 pom.xml 本身中添加其他存储库(settings.xml 镜像配置没有完成这项工作,我还不知道为什么)。例如:nexus/content/repositories/releases/ et nexus/content/repositories/releases/、sousrepository.jboss.org、ou download.java.net/maven/2。

最后,无论如何,使用轻型工具直接彻底修复本地存储库肯定可以节省大量时间(!..)。我还没找到它。实际上它通常应该是一个 mvn 命令(“--repair-local-repository”)。

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").

笑忘罢 2025-01-02 06:31:40

遇到了同样的问题。
就我而言,我在代理后面工作。

我的解决方案是

  1. 修改.m2文件夹中的settings.xml文件以添加代理配置。

    代理人
    真的
    http
    172.23.182.63
    4145

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

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

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

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.

迷途知返 2025-01-02 06:31:40

一定是配置问题。你的 pom 没问题。

这就是我所做的。新建文件夹,把你的pom放进去。然后在eclipse中:导入->行家 ->现有的 Maven 项目。依赖项已包含在项目中。

我使用 eclipse helios 完成了此操作。我认为我使用的插件版本是 0.12

您应该检查 eclipse 中的 maven 属性。

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.

诗笺 2025-01-02 06:31:40

这个错误困扰了我两天。我尝试了各种解决方案,但没有任何效果。最后我放弃了,尝试了一种激进的方法。成功了!步骤如下:

  1. 保存 pom.xml 的副本,
  2. 删除 pom.xml 中的所有文本
  3. 让 eclipse 进行干净的重建,当然一切都会被破坏。
  4. 粘贴回原始 pom.xml 中的所有内容
  5. 让 Eclipse 再次构建

我猜它是“不确定的”,正如下面的文章所述。

http://wiki.eclipse.org/M2E_plugin_execution_not_covered

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

空心空情空意 2025-01-02 06:31:40

就我而言,有一个没有版本的依赖项。在 Eclipse 中,m2e 不会强制您输入版本,因此我将其留空。一旦我从 Eclipse 中将版本放入 pom.xml 中,一切都很好

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

玩套路吗 2025-01-02 06:31:40

我对默认的groovy编译器插件有类似的情况解决

方案是根据这个答案安装Springsource提供的ME2

Pluginexecutionnotcoveredbylifecycleconfigurationmavenerror

这立即解决了 EclispeJuno 中的“Pluginexecutionnotcoveredbylifecycleconfiguration”问题。

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.

心碎的声音 2025-01-02 06:31:40

我遇到了同样的问题,但有其他原因。解决方案是停用 Avira 浏览器保护(德语为 Browser-Schutz)。我从 m2e 无法传输元数据nexus,但是maven命令行可以。如果maven有需要的插件,可以再次激活它。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文