【问题标题】:m2e Eclipse indigo gives errorm2e Eclipse 靛蓝给出错误
【发布时间】:2011-11-17 20:14:46
【问题描述】:

我已经在本地不使用eclipse设置Maven项目,成功完成。 现在我已经下载了 Eclipse indgo 3.7.0。由于 Eclipse-indigo 有 m2e(maven 2 eclipse )plugin 通过

启用它

Eclipse->帮助->安装新软件->使用(Indigo - http://download.eclipse.org/releases/indigo)->通用工具->m2e(检查)并安装。

在 Eclipse 中将项目添加为 maven 项目,但在运行 pom.xml 文件时出现错误:

Downloading: http://mirrors.ibiblio.org/pub/mirrors/maven2/org/apache/maven/plugins/maven-resources-plugin/2.4.3/maven-resources-plugin-2.4.3.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.625s
[INFO] Finished at: Thu Sep 15 12:33:01 CEST 2011
[INFO] Final Memory: 5M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:2.4.3 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.4.3: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.4.3 from/to ibiblio.org (http://mirrors.ibiblio.org/pub/mirrors/maven2): null to http://mirrors.ibiblio.org/pub/mirrors/maven2/org/apache/maven/plugins/maven-resources-plugin/2.4.3/maven-resources-plugin-2.4.3.pom: UnresolvedAddressException -> [Help 1]
[ERROR] 

这是m2e插件问题,我该如何解决这个错误?

在将现有 maven 项目导入 Eclipse 时也出现以下错误:

Could not calculate build plan
Plugin org.apache.maven.plugins:maven-resources-plugin:2.4.1 or one of its dependencies 
could not be resolved: Transfer error: null
org.apache.maven.plugins:maven-resources-plugin:maven-plugin:2.4.1

from the specified remote repositories:
ibiblio.org (http://mirrors.ibiblio.org/pub/mirrors/maven2, releases=true, snapshots=false)
Description Resource    Path    Location    Type
Could not calculate build plan: Failure to transfer org.apache.maven.plugins:maven-resources-plugin:pom:2.4.3 
    from http://mirrors.ibiblio.org/pub/mirrors/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of ibiblio.org has elapsed or 
    updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.4.3 from/to ibiblio.org 
    (http://mirrors.ibiblio.org/pub/mirrors/maven2): null to http://mirrors.ibiblio.org/pub/mirrors/maven2/org/apache/maven/plugins/maven-resources-plugin/2.4.3/maven-resources-
    plugin-2.4.3.pom    my-app      Unknown Maven Problem

POM.xml:

 <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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.test.myapp</groupId>
  <artifactId>my-app</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>
  <name>my-app</name>
  <url>http://maven.apache.org</url>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
</project>

【问题讨论】:

  • 你的 settings.xml 文件是什么样子的?在我看来,您以某种方式更改了 settings.xml ......但您不应该导致 ibiblio 不是 Maven Central 我建议改用 repo1.maven.org/maven2
  • 你检查过在命令行上构建你的项目只是 mvn clean package 吗?
  • @khmarbaise,来自 cmd maven 工作正常。唯一的问题是 eclipse 插件 m2e。
  • 如果您没有更改其他内容,为什么您的 maven 会从 ibiblio 而不是 Maven Central 下载?我建议清理你的本地存储库(如上所述)并在命令行上做其他时间......顺便说一句:你在命令行上使用的是哪个版本的 Maven?
  • 转到 maven settings.xml 文件并启用代理。 stackoverflow.com/questions/5704010/maven-in-5-min-not-working

标签: eclipse maven


【解决方案1】:

检查本地存储库下org/apache/maven/plugins/maven-resources-plugin/ 中的sha1 校验和,如果其中任何一个错误,请删除maven-resources-plugin 目录。或者干脆删除目录,让maven重新下载。

【讨论】:

    【解决方案2】:

    已解决,问题是因为在组织中工作(启用了代理),在 settings.xml 中启用了代理,由 maven in 5 min not working

    【讨论】:

      【解决方案3】:

      Eclipse 有一个内置的 Maven 实现。尝试使用与 Eclipse 相同的 Maven 版本从命令行编译项目,或在 Eclipse 中设置 Maven 安装(Window / Preferences / Maven / Installations)。

      【讨论】:

      • 当我从 cmd 编译时,它工作正常,正如我在问题中告知的那样
      • 你的命令行Maven的版本和Eclipse的一样吗? (通常是 3.0-SNAPSHOT)你试过改变你的 Eclipse 的 Maven 吗?
      • 我已从 eclipse->window->preference->Maven->user 设置更改了存储库位置和 settings.xml。如何在 Eclipse 中更改 Maven 位置?
      • Eclipse / 窗口 / 首选项 / Maven / 安装
      猜你喜欢
      • 2012-02-12
      • 1970-01-01
      • 1970-01-01
      • 2013-06-25
      • 2013-09-26
      • 2016-08-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多