Search This Blog

Thursday, November 01, 2018

Maven settings.xml custom Java Home property Example

There are two locations where a settings.xml file may live:
  • The Maven install: $M2_HOME/conf/settings.xml
  • A user’s install: ${user.home}/.m2/settings.xml
The former settings.xml are also called global settings, the latter settings.xml are referred to as user settings. If both files exists, their contents gets merged, with the user-specific settings.xml being dominant.
Tip: If you need to create user-specific settings from scratch, it’s easiest to copy the global settings from your Maven installation to your ${user.home}/.m2directory. Maven’s default settings.xml is a template with comments and examples so you can quickly tweak it to match your needs.
A custom JAVA_8_HOME property in Maven settings.xml shown in the following: