Changing the default Maven repository location in eclipse
Sometimes we may required to modify the default maven repository location to custom location for the eclipse project.Eclipse project will have the variable M2_REPO defined as read only.
The following steps will help as to change the default Mavan repository location.
Modify the settings.xml file in the <<USER_HOME>>/.m2 and add the localRepository value accordingly.
If the .m2 folder ia not available in the USER_HOME create the same(md .m2) and also create a settings.xml file and update the file with the following contents(change the value of localrepository and the repository url accordingly)
<settings>
<localRepository>D:\Albin\TCS\TR\Projects\MISSOA\.m2\repository</localRepository>
<profiles>
<profile>
<id>myprofile</id>
<repositories>
<repository>
<id>my-repo2</id>
<name>my custom repo</name>
<url>http://a.com/repository</url>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>myprofile</activeProfile>
</activeProfiles>
</settings>
Verify the Maven settings in eclipse(Windows-->Preferences-->Maven-->UserSettings)
Now the maven dependency jar files in the build path will be referenced from the new location
Thank you very much
ReplyDelete