Eclipse + Maven – M2_REPO is Non Modifiable

In previous article, we have covered how to set M2_REPO classpath variable for maven dependencies resolution in Eclipse IDE

Sometimes by default M2_REPO classpath variable comes added with Eclipse IDE, especially in the newer versions like Kepler, Luna or Mars OR if you install maven plugins to older versions of Eclipse IDE like Juno or Indigo

Although, its seems to be good news with pre-built Maven integration with Eclipse IDE but the annoying thing is –> this is doesn’t point to correct maven local repository location and in addition to this, classpath variable M2_REPO is non-modifiable

Q) Are there are any solutions to rectify it?

  • Very well, we can modify this classpath variable but not directly –> there is way to go
  • Let’s see what is the solution to correct it

1. Solution for M2_REPO is Non Modifiable :

Step 1: Open Eclipse IDE –> Windows –> Preferences

1_Eclipse-Maven_M2_REPO_Non_Modifiable_open_eclipse

Step 2: Maven –> Users Settings

User Settings (open file)
Browse through the correct “settings.xml” file –> Click “Update Settings

Local Repository (from merged user and global settings)
This is will update the “Local Repository” location –> picking the value of <localRepository> tag from the settings.xml

2_Eclipse-Maven_M2_REPO_Non_Modifiable_windows_preferences_maven

That’s all ….. automatically everything will get updated

2. Useful Eclipse IDE shortcuts :

Related Articles:

Happy Coding !!
Happy Learning !!

Eclipse + Maven - Creating and exploring projects using archetypes
Eclipse + Maven - Setting M2_REPO classpath variable in IDE