【问题标题】:m2eclipse errorm2eclipse错误
【发布时间】:2012-02-08 17:25:18
【问题描述】:

我正在使用 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>

有什么想法吗?

【问题讨论】:

  • 错误提示 maven 无法访问远程存储库。 “mvn clean package”可以在控制台上运行吗?
  • 我使用 Windows 的同事也有同样的问题。我正在使用 ubuntu,相同版本的 maven 和 eclipse,相同的项目……一切正常……
  • 在我的情况下,它只用 mvn clean install -U 解决了
  • 如果所需插件的版本与 maven 存储库中的版本不同,可能会发生这种情况,例如在恢复旧项目时,其中一个 maven 插件的版本较早.如果是这种情况,更新到已安装插件的正确版本号,将修复它。

标签: eclipse maven m2eclipse


【解决方案1】:

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

就我而言,问题是由于{user.home}\.m2\repository\org\apache\maven\plugins\maven-resources-plugin\2.4.3 文件夹中缺少maven-resources-plugin-2.4.3.jar 引起的。 (不知道为什么 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 &gt; Update Project Configuration...(右键单击)

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

【讨论】:

  • 你检查过存储库中有org\apache\maven\plugins\maven-resources-plugin\2.4.3吗?
  • 是的,2.3、2.4.3 和 2.5。实际上,经过多次刷新, mvn install eclipse:eclipse,清理,关闭并重新打开 eclipse,它终于似乎工作了......但是,它变成了另一个错误:“未知错误”。有什么想法吗?
【解决方案2】:

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

Eclipse 没有选择我的 maven 设置,所以这是我解决问题的方法:

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

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

  3. 关闭 Eclipse

  4. 运行 mvn install 从命令行。

  5. 打开 Eclipse

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

【讨论】:

    【解决方案3】:

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

    【讨论】:

    • 解决了我的问题..谢谢..:)
    • 也为我工作!谢谢!
    • 稍微不那么激烈 - 我刚刚删除了.m2\repository\org\apache\maven
    【解决方案4】:

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

    【讨论】:

    • 我必须先编辑 pom.xml 文件以添加对导致问题的模块的依赖项(在我的情况下为 org.apache.maven.plugins:maven-jar-plugin),然后在 ECLIPSE 之外运行 mvn clean 然后 mvn -U install 在项目文件夹中。然后我重新启动了 eclipse 并对项目进行了清理/构建,一切都很好。
    【解决方案5】:

    在这种特殊情况下,解决方案是正确的eclipse代理配置(Window -> Preferences -> Network Connection),该公司拥有严格的安全系统。我会留下这个问题,因为有可以帮助社区的答案。非常感谢楼上的回答。

    【讨论】:

      【解决方案6】:

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

      【讨论】:

        【解决方案7】:

        这对我有帮助:

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

        祝你好运。

        【讨论】:

          【解决方案8】:

          我会补充一些帮助我解决这个问题的要点:

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

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

          也非常值得:

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

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

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

            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/, sous repository.jboss.org, ou download.java.net/maven/2 .

          无论如何,为了完成,本可以使用大量时间(!..),当然仍然可以使用轻型工具直接彻底修复本地存储库。我还找不到它。实际上它通常甚至应该是一个 mvn 命令(“--repair-local-repository”)。

          【讨论】:

            【解决方案9】:

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

            我的解决方案是

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

              代理 真的 http 172.23.182.63 4145

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

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

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

            【讨论】:

            • 第 2 步对我来说是关键......我已经修改了 maven 安装下的 settings.xml 文件,但没有指示 Eclipse 使用它。第 3 步无关紧要,但第 4 步效果很好。
            【解决方案10】:

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

            这就是我所做的。新文件夹,把你的pom放进去。然后在eclipse中:import -> maven -> existing maven project。依赖项包含在项目中。

            我使用 eclipse helios 做到了这一点。我认为我使用的插件版本是0.12

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

            【讨论】:

            • eclipse中的maven属性在哪里?
            • 我尝试将 pom 文件放入一个新文件夹中。当我尝试导入项目时,eclipse 显示两个错误: * 没有找到在 Eclipse 中处理 maven-compiler-plugin:2.3.2:testCompile 的市场条目。和 * 没有找到在 Eclipse 中处理 maven-compiler-plugin:2.3.2:compile 的市场条目。 // 有什么想法吗?
            【解决方案11】:

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

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

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

            http://wiki.eclipse.org/M2E_plugin_execution_not_covered

            【讨论】:

              【解决方案12】:

              在我的情况下,有一个没有版本的依赖项。在 Eclipse m2e 中,不会强制您输入版本,所以我将其留空。一旦我从 Eclipse 中将版本放入 pom.xml 中,一切都很好

              【讨论】:

                【解决方案13】:

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

                解决办法是根据这个答案安装Springsource提供的ME2

                Plugin execution not covered by lifecycle configuration maven error

                这立即解决了 Eclispe Juno 中“生命周期配置未涵盖插件执行”的问题。

                【讨论】:

                  【解决方案14】:

                  我遇到了同样的问题,但有其他原因。解决方案是停用 Avira 浏览器保护(德语 Browser-Schutz)。我从m2e cannot transfer metadata from nexus, but maven command line can 那里得到了解决方案。 maven有需要的插件可以再次激活。

                  【讨论】:

                    【解决方案15】:

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

                    未找到处理 Execution default-testResources 的市场条目

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

                    希望对你也有帮助。

                    【讨论】:

                      【解决方案16】:

                      以下步骤对我有用:

                      1. 关闭 Eclipse。
                      2. 导航到用户主目录。 (例如:“C:\Users\YourUserName.m2”)
                      3. 删除“存储库”文件夹。
                      4. 重新打开 Eclipse。
                      5. 单击有问题的 Maven 项目,然后转到“项目”-->“清理”。
                      6. 右键单击项目并转到“Maven”-->“更新项目...”。
                      7. 关闭 Eclipse。
                      8. 打开 Eclipse。
                      9. 单击“项目资源管理器”窗口中的项目文件夹(通常位于左侧)。
                      10. 按几次“F5”键以刷新您的项目。
                      11. 完成! 这些步骤在 Eclipse Luna 中对我有用。如果我能提供更多帮助,请告诉我。

                      【讨论】:

                        【解决方案17】:

                        我的问题是 eclipse 在安装目录中找不到 mvn.bat 文件。解决方法是创建一个 mvn.bat 文件,代码如下:

                        "%~dp0\mvn.cmd" %*
                        

                        保存该文件。放在【Maven 安装文件夹】\bin 目录下。

                        【讨论】:

                          猜你喜欢
                          • 1970-01-01
                          • 2012-03-03
                          • 2011-05-31
                          • 2011-08-22
                          • 2014-08-06
                          • 2011-04-02
                          • 1970-01-01
                          • 1970-01-01
                          • 1970-01-01
                          相关资源
                          最近更新 更多