清理Maven m2e .cache目录 [英] Cleaning Maven m2e .cache directory

查看:598
本文介绍了清理Maven m2e .cache目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Maven安装(Windows 7 64位)的.cache目录几乎为3.5GB!它仅包含一个m2e目录. (我正在使用m2e运行Eclipse 4.3M7.)现在肯定不需要里面的所有东西,而且我什至不知道这是什么东西!我找不到在线.cache目录的Maven文档.

My Maven installation (Windows 7 64-bit) has a .cache directory that is almost 3.5GB! It contains only a m2e directory. (I'm running Eclipse 4.3M7 with m2e.) Surely all the things inside aren't needed at present, and moreover I don't even know what this stuff is! I could find no Maven documentation of a .cache directory online.

那么.m2/repository/.cache.m2/repository/.cache/m2e目录是什么?为什么他们几年前有这么多东西?我该如何处置所有不再需要的东西?

So what are the .m2/repository/.cache and .m2/repository/.cache/m2e directories? Why do they have so much stuff from years ago? How do I dispose of all the stuff that's not needed anymore?

推荐答案

与其他答案相反,请确保保留.m2/*.xml(您的设置)和.m2/repository(并非必须保留),但是Maven将拥有再次下载一半的互联网.

In contrast to the other answers, make sure to keep .m2/*.xml (your settings) and .m2/repository (not strictly necessary to keep, but Maven will have to download half the Internet again).

现在,对于那个.cache文件夹:如果打开Eclipse,M2Eclipse有时会运行类似于下载存储库索引"的作业.如果您仅知道工件的ID(一部分),这些索引使您可以使用M2E的添加依赖项"向导快速找到工件.它需要将下载的索引文件放在某个地方,并根据 http://dev.eclipse.org /mhonarc/lists/m2e-users/msg02486.html .cache文件夹是其中的位置:

Now, as for that .cache folder: if you open Eclipse, M2Eclipse will sometimes run a job akin to "Downloading repository indexes". These indexes allow you to quickly find an artifact using M2E's "Add dependency" wizard if you only know (part of) its artifact id. It needs to put the downloaded index files somewhere, and according to http://dev.eclipse.org/mhonarc/lists/m2e-users/msg02486.html the .cache folder is where they go:

还要注意,m2e每个存储库至少保留三个副本 指数.从远程存储库下载的原始.gz文件.一种 共享Lucene实例,用于优化处理gz所花费的时间 文件.以及每个工作区的Lucene索引.前两个存储 在本地存储库.cache/m2e目录下,最后一个是 每个工作区.

Also note that m2e keeps at least three copies of each repository index. The original .gz files downloaded from remote repositories. A shared lucene instance used to optimize time spent processing gz files. And per-workspace lucene indexes. The first two are stored under local repository .cache/m2e directory, the last one is per-workspace.

他们谈论的Lucene内容是经过优化的搜索数据库,如果您仅输入部分工件ID或组ID,这将使M2E更快地搜索给定的工件.

The Lucene stuff they're talking about are extra optimized search databases, this makes it faster for M2E to search a given artifact if you only enter a partial artifact id or group id.

如果我阅读 http://dev.eclipse.org/mhonarc/lists/m2e- users/msg01708.html 正确,则应安全删除它们:

If I read http://dev.eclipse.org/mhonarc/lists/m2e-users/msg01708.html correctly then it should be safe to remove them:

m2e在两个位置缓存lucene索引.每个工作区索引为 存储在.metadata/.plugins/org.eclipse.m2e.core/nexus下并在那里 也是〜/.m2/repository/.cache/m2e/$ {m2e.version}中的全局缓存.

m2e caches lucene index in two places. Per-workspace indexes are stored under .metadata/.plugins/org.eclipse.m2e.core/nexus and there is also global cache in ~/.m2/repository/.cache/m2e/${m2e.version}.

尝试清理缓存,看看问题是否消失.

Try cleaning the caches and see if the problem goes away.

请记住,尽管下次您打开Eclipse时M2E会注意到丢失的文件夹,所以请准备等待它再次下载所有存储库索引!

Keep in mind though that M2E will notice the missing folder the next time you open Eclipse, so be prepared to wait while it downloads all repository indexes again!

这篇关于清理Maven m2e .cache目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆