bhavanak
bhavanak

Reputation: 255

How to get the path of maven settings.xml programmatically

Is there a way to get the path of the maven settings.xml file in a java program like from default system property or maven options.I want to avoid getting that information from user through a configuration file.

Upvotes: 0

Views: 721

Answers (1)

Raja Anbazhagan
Raja Anbazhagan

Reputation: 4564

As per the maven documentation,

There are two locations where a settings.xml file may live:

  • The Maven install: ${maven.home}/conf/settings.xml
  • A user’s install: ${user.home}/.m2/settings.xml

To access maven.home

System.getenv("M2_HOME");

To access user.home

System.getProperty("user.home");

Upvotes: 1

Related Questions