New version of Eclipse like Photon or Eclipse IDE 2019-06 has M2_REPO classpath variable after integrating maven plugins (m2eclipse) with Eclipse IDE, M2_REPO classpath variable gets added –> pointing to default locations (for example c:\Users\\.m2\repository) and this variable is non-modifiable. However, if we are using older version of Eclipse, then we need to add M2_REPO manually to Eclipse.
Steps to add M2_REPO
- Open Eclipse IDE, select Window ->Preferences ->Java ->Classpath Variables

2. Click on New Button. Add below mentioned information:-
Name – M2_REPO
Path – Path where M2 file places in your system
Eg – C:\Users\SingVi04\.m2\repository

Note:- I have already added M2_REPO, so we can see an error message – Variable name already exists.
3. Verify that M2_REPO add – You can check new Classpath variable M2_REPO is added under BuildPath ->Classpath Variables
