Changing the location of your local Maven repository

By default Apache Maven puts your local repository under the users home drive ${user.home}/.m2/repository.

Generally this isn’t too much of an issue, however if you work off roaming profiles in windows or your home drive is stored on a network drive this can sometimes be undesirable as the repository can get fairly large. Therefore you may want to re-locate it to an alternative location.

This can be fairly easily achieved by defining the location in your ${user.home}/.m2/settings.xml file. If this file does not exist then create one and add the following content to it.

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns=""

More information on this can be found in the Apache Maven documentation here.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.