如何清除.m2 Maven文件夹? [英] How to clear .m2 Maven folder?
问题描述
我的计算机运行Windows 10,并且可以使用Java和Eclipse.最近Windows警告我磁盘空间不足,经过一番研究,我注意到我的用户文件夹(C:\Users\MySelf
)下有一个名为.m2
的文件夹,占用202Gb.
My computer runs Windows 10 and I work with Java and Eclipse. Recently Windows warned me that I'm running into short disk space and after some study I noticed that I have a folder named .m2
under my user's folder (C:\Users\MySelf
) that occupies 202Gb.
我知道此文件夹属于Maven.由于此文件夹大于我所有项目及其依赖项的总和,因此在我看来Maven保留着不必要的文件,所以我想摆脱它们.
I know this folder belongs to Maven. Since this folder is bigger than all my projects and their dependencies together, it seems to me that Maven is keeping unnecessary files, so I want to get rid of them.
仅删除文件夹内容是安全的吗?还是应该运行某些特定过程以节省空间并保持Maven正常运行?
Is is safe simply delete the folder contents or should I run some particular process in order to save space and keep Maven working well?
推荐答案
删除文件夹.m2/repository
是非常安全的,因为maven会在需要时重新下载所有必需的依赖项(本地项目除外) >. .m2
下是否还有其他文件夹占用空间?
It's perfectly safe to delete the folder .m2/repository
as maven will re-download all the needed dependencies when needed except for your local projects. It there any other folder under .m2
taking space?
对于您的本地项目,maven会抱怨找不到它们.在这种情况下,您只需要重新编译它们并通过在每个项目文件夹中运行mvn clean install
来安装它们.他们将被上传到存储库.
For your local projects, maven will complain about not finding them. In that case, you simply need to re-compile them and install them by running mvn clean install
in each project folder. They will get uploaded to the repository.
这篇关于如何清除.m2 Maven文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!