How to change Maven local repository location

The default path for the maven local repository is ${user.home}/.m2/repository/

Please follow the tutorial if you are not installed, maven.

Change maven local repository path

Find the M2 location as ,{M2_HOME}\conf\ where M2_HOME is maven installation folder.

In our case the location is


C:\Program Files\Maven\apache-maven-3.6.3\conf
Change maven local repository location

Open settings.xml

<settings> ... <localRepository>/path/to/local/repo/ </localRepository> ... </settings>

Find the tag <localRepository>

Update the desired path in the value of this tag. Save the file.

in our case it is

C:\Program Files\Maven\repository
Maven local repository path

In this article, we have seen How to change Maven local repository location with Example.