eclipse 如何手动更新 Maven 索引?

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

How can I update Maven Index manually?

eclipsemaven

提问by nyx

I have this problem:

我有这个问题:

When I start Eclipse (Indigo Service Release 1 with Maven Integration for Eclipse)it's trying to download a file from Maven Repositories :

当我启动 Eclipse (Indigo Service Release 1 with Maven Integration for Eclipse)时,它试图从 Maven Repositories 下载文件:

repo1.maven.org/maven2/.index/nexus-maven-repository-index.gz

It reaches about 10-20% (this takes loooong) and then apparently it gives up:

它达到大约 10-20%(这需要 loooong),然后显然它放弃了:

02.05.12 08:47:36 MESZ: Updating index central|http://repo1.maven.org/maven2
02.05.12 09:09:25 MESZ: Unable to update index for central|http://repo1.maven.org/maven2

Now I tried to download this gz-file manually because I thought, the download hits any timeout within Eclipse. Now I have another two problems:

现在我尝试手动下载这个 gz 文件,因为我认为下载会在 Eclipse 中遇到任何超时。现在我还有两个问题:

  1. The direct download of the 48,7 MB-gz-file canceled after 9,6 MB. I have no clue why.
  2. If I'd be able to download the gz-file, I don't know how to "put it into" Eclipse/Maven or tell Maven to use the file on my PC and not the repository repo1.maven.org.
  1. 48,7 MB-gz 文件的直接下载在 9,6 MB 后取消。我不知道为什么。
  2. 如果我能够下载 gz 文件,我不知道如何将它“放入”Eclipse/Maven 或告诉 Maven 在我的 PC 上使用该文件而不是存储库 repo1.maven.org。

Any helpful ideas or answers?

任何有用的想法或答案?

回答by Henrique Miranda

  1. Delete the cache from .m2/repository/.cache/m2e.
  2. Open your eclipse
  3. Menu Windows > Preferences > Maven > User Settings > Update Settings
  1. 从 中删除缓存.m2/repository/.cache/m2e
  2. 打开你的日食
  3. 菜单 Windows > 首选项 > Maven > 用户设置 > 更新设置

Eclipse will download it again, should work now.

Eclipse 将再次下载它,现在应该可以工作了。

回答by FrVaBe

Try to change the timeout settings like described here. I do not know which setting is responsible for the repository index update, you have to try a bit...

尝试像这里描述的那样更改超时设置。不知道是哪个设置负责repository索引更新,你要试一下...

-Dsun.net.client.defaultReadTimeout=60000
-Dorg.eclipse.ecf.provider.filetransfer.retrieve.readTimeout=60000

You should consider to disable the index update on startup (disable: Preferences -> Maven -> Download repository index updates on startup) and only update manually in the Maven Repositories View using the context menu on the central repository.

您应该考虑在启动时禁用索引更新(禁用:),Preferences -> Maven -> Download repository index updates on startup并且仅使用中央存储库上的上下文菜单在 Maven 存储库视图中手动更新。

回答by Alex

Well, that may be a little bit complicated but it worked for me:

好吧,这可能有点复杂,但对我有用:

  • First I used wget -cto download nexus-maven-repository-index.gz; took me about 10 retries and an hour; you may use any download manager you like
  • Second, installed Fiddler
  • Then updated <proxy>configuration in local maven settings.xmlwith Fiddler details
  • Enabled breakpoints in Fiddler
  • When Eclipse asked for nexus-maven-repository-index.gz used a Fiddler feature to substitute a response with a downloaded file
  • 首先我用wget -c下载了 nexus-maven-repository-index.gz;我花了大约 10 次重试和一个小时;您可以使用任何您喜欢的下载管理器
  • 二、安装Fiddler
  • 然后使用 Fiddler 详细信息更新<proxy>本地 maven settings.xml 中的配置
  • 在 Fiddler 中启用断点
  • 当 Eclipse 要求 nexus-maven-repository-index.gz 使用 Fiddler 功能用下载的文件替换响应时

回答by Gangnus

A more drastic way: delete the whole .metadata folder. Later import projects from their place or checkout them from the svn(if you use some). This is not much more complicated, but it helped. the problem is that we don't really know, what metadata are broken, so the natural next step is to delete all of them. I think, it is the deepest possible cleaning before reinstallation of Eclipse + plugins.

更彻底的方法:删除整个 .metadata 文件夹。稍后从它们的位置导入项目或从 svn 检出它们(如果您使用一些)。这并不复杂,但它有帮助。问题是我们真的不知道哪些元数据被破坏了,所以下一步自然是删除所有元数据。我认为,这是在重新安装 Eclipse + 插件之前最深入的清理。