Search code examples
eclipsemavenp2

What are ~/.m2 and ~/.p2 folders and can I delete them?


I know they are somehow linked to Eclipse and .m2 is related to maven.

However, I never really used maven and I don't use it anymore, though I still use Eclipse, and these two folders ~/.p2 and ~./m2 are about 4Gb each and I'm wondering if I can simply delete them.

To clarify, my ~/.p2 folder looks like that:

cd ~/.p2
du -sh */
3.2M    org.eclipse.equinox.p2.core/
 48M    org.eclipse.equinox.p2.engine/
 45M    org.eclipse.equinox.p2.repository/
3.6G    pool/

I'm wondering if pool/ folder needs to be that big or do I have relic/zoombie files there and how to find out about it?

For example, why do I have so many versions of PyDev?

drwxr-xr-x 6 alan staff 192 Apr  4  2016 /Users/alan/.p2/pool/plugins/org.python.pydev.core_4.5.5.201603221110
drwxr-xr-x 6 alan staff 192 May 11  2016 /Users/alan/.p2/pool/plugins/org.python.pydev.core_5.0.0.201605051159
drwxr-xr-x 6 alan staff 192 Jun 22  2016 /Users/alan/.p2/pool/plugins/org.python.pydev.core_5.1.1.201606162013
drwxr-xr-x 6 alan staff 192 Jun 28  2016 /Users/alan/.p2/pool/plugins/org.python.pydev.core_5.1.2.201606231256
drwxr-xr-x 6 alan staff 192 Sep 16  2016 /Users/alan/.p2/pool/plugins/org.python.pydev.core_5.2.0.201608171824
drwxr-xr-x 6 alan staff 192 Oct 26  2016 /Users/alan/.p2/pool/plugins/org.python.pydev.core_5.3.0.201610121612
drwxr-xr-x 6 alan staff 192 Nov  1  2016 /Users/alan/.p2/pool/plugins/org.python.pydev.core_5.3.1.201610311318
drwxr-xr-x 6 alan staff 192 Dec  8  2016 /Users/alan/.p2/pool/plugins/org.python.pydev.core_5.4.0.201611281236
drwxr-xr-x 6 alan staff 192 Jan 25  2017 /Users/alan/.p2/pool/plugins/org.python.pydev.core_5.5.0.201701191708
drwxr-xr-x 6 alan staff 192 Mar 22  2017 /Users/alan/.p2/pool/plugins/org.python.pydev.core_5.6.0.201703221358
drwxr-xr-x 6 alan staff 192 Apr 12  2017 /Users/alan/.p2/pool/plugins/org.python.pydev.core_5.7.0.201704111357
drwxr-xr-x 6 alan staff 192 Jun 16  2017 /Users/alan/.p2/pool/plugins/org.python.pydev.core_5.8.0.201706061859
drwxr-xr-x 6 alan staff 192 Aug 28  2017 /Users/alan/.p2/pool/plugins/org.python.pydev.core_5.9.2.201708151115
drwxr-xr-x 6 alan staff 192 Sep 22  2017 /Users/alan/.p2/pool/plugins/org.python.pydev.core_6.0.0.201709191431
drwxr-xr-x 6 alan staff 192 Nov  9  2017 /Users/alan/.p2/pool/plugins/org.python.pydev.core_6.1.0.201711051306
drwxr-xr-x 6 alan staff 192 Nov 29  2017 /Users/alan/.p2/pool/plugins/org.python.pydev.core_6.2.0.201711281614
drwxr-xr-x 7 alan staff 224 Mar  1  2018 /Users/alan/.p2/pool/plugins/org.python.pydev.core_6.3.1.201802272029
drwxr-xr-x 7 alan staff 224 Mar 23  2018 /Users/alan/.p2/pool/plugins/org.python.pydev.core_6.3.2.201803171248
drwxr-xr-x 7 alan staff 224 May 15  2018 /Users/alan/.p2/pool/plugins/org.python.pydev.core_6.3.3.201805051638
drwxr-xr-x 7 alan staff 224 Jul 12  2018 /Users/alan/.p2/pool/plugins/org.python.pydev.core_6.4.3.201807050139
drwxr-xr-x 7 alan staff 224 Aug  9  2018 /Users/alan/.p2/pool/plugins/org.python.pydev.core_6.4.4.201807281807
drwxr-xr-x 7 alan staff 224 Oct  2  2018 /Users/alan/.p2/pool/plugins/org.python.pydev.core_6.5.0.201809011628
drwxr-xr-x 7 alan staff 224 Nov  9  2018 /Users/alan/.p2/pool/plugins/org.python.pydev.core_7.0.3.201811082356
drwxr-xr-x 7 alan staff 224 Feb 12  2019 /Users/alan/.p2/pool/plugins/org.python.pydev.core_7.1.0.201902031515
drwxr-xr-x 7 alan staff 224 Jul  1  2019 /Users/alan/.p2/pool/plugins/org.python.pydev.core_7.2.1.201904261721
drwxr-xr-x 7 alan staff 224 Aug 31  2019 /Users/alan/.p2/pool/plugins/org.python.pydev.core_7.3.0.201908161924
drwxr-xr-x 7 alan staff 224 Nov  7  2019 /Users/alan/.p2/pool/plugins/org.python.pydev.core_7.4.0.201910251334
drwxr-xr-x 8 alan staff 256 Mar  9 10:20 /Users/alan/.p2/pool/plugins/org.python.pydev.core_7.5.0.202001101138
drwxr-xr-x 8 alan staff 256 Jun  6 13:49 /Users/alan/.p2/pool/plugins/org.python.pydev.core_7.6.0.202006041357

I also have files as old as 2012, which I'm quite sure I'm not using them.


Solution

    • .m2 is your local Maven repository. It contains all ever downloaded Maven dependencies and Maven plugins. You can delete this folder (except maybe existing configuration/settings files, outside of the repository subfolder). If required Maven will recreate this folder and download everything: in Eclipse right-click a project and choose Maven > Update Project..., click Select All and hit OK

    • .p2 of this size contains most of your Eclipse installation (all plugins Eclipse is made up of) that you installed via the Eclipse Installer (in contrast to installing Eclipse via unpacking a ZIP or using a DMG file on macOS where the plugins are contained in the plugins subfolder). Do not delete this folder, otherwise you will not be able to start Eclipse anymore. To clean up this folder, run the Eclipse Installer, in the top right menu select Bundles Pools... (in Eclipse, the term bundle is a synonym for plugin) and in the Bundles Pool Management dialog run Clear Cache... and Cleanup Agent...