How do I configure Maven for a user rather than globally?

Maven global settings for all users are configured using settings.xml file which will come along with maven distribution, will reside in conf directory of maven. To set settings for an individual user on your PC and  configure maven for a user, you can make a copy of settings.xml file into .m2 directory of user home directory. This file will now hold settings specific to user.

The settings.xml comes with useful comments so that you can configure on your own. I have installed my maven3.x distribution at  C:\maven  so, settings.xml will be in the path  C:\maven\conf\settings.xml

Maven Conf directory

I have copied this settings.xml and pasted in my home directory’s .m2 directory. Run a maven command, like ‘ mvn clean ‘. So, my path to my user settings.xml is C:\Users\shankar\.m2\settings.xml.

Maven User Directory

Now I can tweak configuration of maven in user specific settings.xml file.

The settings.xml file

 

Leave a Comment