Settings in Maven

Maven settings can be specified in 2 files.
  • User settings file - ~/.m2/settings.xml
  • Maven global settings file - maven_home/conf/settings.xml
Now let us discuss what kind of settings can be configured for maven.

Repository Path

Default repository path is ~/.m2/repository But you can change is using below tag in settings.xml

Interactive mode

Maven interactive mode is true by default. But you change it to false using below tag in settings.xml

Offline mode

Offline mode – It is false by default. But you can change it using below tag.

Proxy settings

As you know that maven downloads the libraries from internet, you will have to provide proxy settings in case you are behind proxy.

Server authentication settings

You can use servers tag to store the authentication information of the servers used by maven
more server configuration

Mirror settings

Sometimes the repository used by maven can not serve the requests due to heavy load. So in such situations, we can use mirrors of that particular repositories to download resources.
<name>Mirror Name</name>

Profiles settings

You can also use profiles so that different settings are used in different conditions. For example – You can create a OS specific profile. Certain tasks are dependent on OS type. So depending upon OS type, specific profile is activated.


Web development and Automation testing

solutions delivered!!