Cleaning the Maven m2e.cache directory

Installing My Maven (64-bit version of Windows 7) has a .cache directory that is almost 3.5 GB! It contains only m2e directory. (I am running Eclipse 4.3M7 with m2e.) Of course, all the things inside are not needed at the moment, and moreover, I don’t even know what this stuff is! I could not find the Maven documentation in the .cache directory on the Internet.

So what are the directories .m2/repository/.cache and .m2/repository/.cache/m2e ? Why did they have so many things many years ago? How do I get rid of everything that is no longer needed?

+42
maven m2e
May 08 '13 at 1:41
source share
4 answers

Unlike other answers, do not forget to save .m2/*.xml (your settings) and .m2/repository (strictly not necessary, but Maven will have to download half of the Internet again).

Now for this .cache folder: if you open Eclipse, M2Eclipse will sometimes run a task similar to “Downloading repository indexes”. These indexes allow you to quickly find an artifact using the M2E Add Addiction wizard if you know (part) of its artifact identifier. It should 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:

Also note that m2e stores at least three copies of each index repository. Source .gz files downloaded from remote repositories. generic lucene instance used to optimize the processing time of gz files. And lucene indexes for workspaces. The first two are stored in the local repository directory .cache / m2e, the last of which is behind the workspace.

The Lucene materials they are talking about have additional optimized search databases, this speeds up the M2E search for this artifact if you enter only the incomplete artifact identifier or group identifier.

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

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

Try clearing the caches and see if the problem persists.

Keep in mind that M2E will see the missing folder the next time you open Eclipse, so be prepared to wait until it loads all the repository indexes again!

+41
May 08 '13 at 15:50
source share

We can do the configuration in eclipse ide to disable the .cache folder for enlargement.

Window-> Settings-> Maven → Download Vault Index Updates at Startup

Disable this option and you will get rid of the .cache problem!

+3
Aug 07 '15 at 4:10
source share

The m2e directory is an Eclipse Maven cache plugin, not Maven.

+2
May 08 '13 at
source share

The .m2 directory is your maven repository cache. Whenever maven downloads something for you, it will cache it here. It is usually safe to simply delete the directory. Maven recreates this for you. However, if you have dependencies that exist only in your repo cache, you will have to reinstall them.

+1
May 08 '13 at 14:03
source share



All Articles