Search code examples
eclipsemavenmaven-3m2eclipse

Where are the global settings for eclipse m2e?


I'm using m2e in eclipse v2020-12. I created a settings.xml file in D:\.m2repo with <localRepository>D:/.m2repo/repository</localRepository>. In eclipse preferences, under Maven, Global Settings, I browsed to that file then clicked Update Settings. After closing eclipse, I moved m2e's repo from the default folder C:\Users\<user>\.m2 to D:\ (it's 30GB and I needed space on C).

Some parts of eclipse recognize the change. Maven user settings shows the new local repo folder and Java classpath variables under build path settings shows MT_REPO (non modifiable) - D:\.m2repo\repository.

However, m2e is still (stubbornly) creating some files in the default folder on C. The most relevant info I could find was a hint of another global settings file in the error message of this 2017 unanswered SO question:

[DEBUG] Reading global settings from EMBEDDED\conf\settings.xml

EDIT: Found maven doc here saying that user settings are "dominant" over global settings. So, I tried the above with the same settings file under Maven, User Settings... same result.


Solution

  • Like you said: unanswered!

    I got it under control (empty/no writes to ~/.m2/repository) after:

    1. Using (in m2e) a "standalone" maven installation. (It's global config location is definitely ${maven.home}/conf/settings.xml) [1]*

    2. (Leaving global config untouched,) Having consistent ~/.m2/settings.xml pointing to <localRepository>D:/...</localRepository>.

    3. "Restoring Defaults" or providing consistent m2e "user (& global) settings".

    4. And to be safe: Re-start your workspace! and even safer: the jvm! ;)

    *: m2e's embedded maven has more bugs & limitations... (to prove)