Eclipse 3.7 (Indigo):如何添加远程 Maven 2 存储库镜像

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6613010/
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-19 16:33:57  来源:igfitidea点击:

Eclipse 3.7 (Indigo): How to add a remote Maven 2 repository mirror

eclipsemaven

提问by Gruber

I recently installed Eclipse 3.7 (Indigo) and now a wanted to start a new project using the integrated Maven plugins.

Problem is, I can't download any dependencies from the central maven 2 repository http://repo1.maven.org/maven2
After creating a new simple Maven project (without an archetype), i constantly get these Error messages:

我最近安装了 Eclipse 3.7 (Indigo),现在想使用集成的 Maven 插件启动一个新项目。

问题是,我无法从中央 maven 2 存储库http://repo1.maven.org/maven2下载任何依赖项
在创建一个新的简单 Maven 项目(没有原型)后,我不断收到以下错误消息:

  • Description Resource Path Location Type CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.3.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2: ArtifactResolutionException: The repository system is offline but the artifact org.apache.maven.plugins:maven-compiler-plugin:pom:2.3.2 is not available in the local repository. pom.xml /JAVA line 1 Maven Project Build Lifecycle Mapping Problem
  • Description Resource Path Location Type Could not calculate build plan: 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 pom.xml /JAVA line 1 Maven Build Problem
  • Description Resource Path Location Type Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (execution: default-compile, phase: compile) pom.xml /JAVA line 1 Maven Project Build Lifecycle Mapping Problem
  • Description Resource Path Location Type 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.xml /JAVA line 1 Maven Project Build Lifecycle Mapping Problem
  • 说明 资源路径位置类型 CoreException:无法计算构建计划:插件 org.apache.maven.plugins:maven-compiler-plugin:2.3.2 或其依赖项之一无法解析:无法读取 org.apache 的工件描述符.maven.plugins:maven-compiler-plugin:jar:2.3.2: ArtifactResolutionException: The repository system is offline but the artifact org.apache.maven.plugins:maven-compiler-plugin:pom:2.3.2 is not available in本地存储库。pom.xml /JAVA line 1 Maven Project Build Lifecycle Mapping问题
  • 描述资源路径位置类型无法计算构建计划:插件 org.apache.maven.plugins:maven-resources-plugin:2.4.3 或其依赖项之一无法解析:无法读取 org.apache.maven 的工件描述符.plugins:maven-resources-plugin:jar:2.4.3 pom.xml /JAVA line 1 Maven Build 问题
  • 说明 资源路径 位置 类型 生命周期配置未涵盖的插件执行: org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (execution: default-compile, phase: compile) pom.xml /JAVA line 1 Maven项目构建生命周期映射问题
  • 描述 资源路径 位置 类型 生命周期配置未涵盖的插件执行: org.apache.maven.plugins:maven-compiler-plugin:2.3.2:testCompile (execution: default-testCompile, phase: test-compile) pom.xml /JAVA line 1 Maven 项目构建生命周期映射问题

Using an archetype doesn't work at all.

使用原型根本不起作用。

Am I right to just add another repository mirror to get the needed dependencies?
If so, how do I add another one?

我只添加另一个存储库镜像来获取所需的依赖项是否正确?
如果是这样,我如何添加另一个?



Update:更新:我写了一个D:\Users\.m2\settings.xmlD:\Users\.m2\settings.xml手动并且 m2e-plugin 正确识别它:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                      http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <localRepository/>
  <interactiveMode/>
  <usePluginRegistry/>
  <offline/>
  <pluginGroups/>
  <servers/>
    <mirrors>
        <mirror>
          <id>dotsrc.org</id>
          <url>http://mirrors.dotsrc.org/maven2</url>
          <mirrorOf>central</mirrorOf>
        </mirror>
    </mirrors>
  <proxies/>
  <profiles/>
  <activeProfiles/>
</settings>

Problem is: I can't find a complete mirror of the Maven central repository. I tried every single one I could find on the net, but all are missing some dependencies, archetypes, etc.

问题是:我找不到 Maven 中央存储库的完整镜像。我尝试了我在网上能找到的每一个,但都缺少一些依赖项、原型等。

Any help out there?

有什么帮助吗?

采纳答案by Michael-O

Try one of these.

尝试的一个这些