oneat
oneat

Reputation: 10994

Use default settings.xml file instead of one in ~/.m2

Is there possibility for Maven to ignore settings.xml contained in .m2 folder?

I want it to use default repository, but my laptop has configured development environment for other repositories and I don't want to lose these settings. What's more, these repositories have priority over repos in my pom.xml and fail if they can't download artifact.

What are the options? Should I choose other settings.xml file or is there option to use none?

Upvotes: 3

Views: 9580

Answers (1)

Gerold Broser
Gerold Broser

Reputation: 14762

You don't have to have a settings.xml in the .m2 folder. If there is none Maven uses <Maven installation folder>/conf/settings.xml, which has everything commented out by default.

See also Settings Reference, Quick Overview:

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

You can use custom settings files with the command line options:

-s,--settings
Alternate path for the user settings file

-gs, --global-settings
Alternate path for the global settings file

And, BTW, .m2 is not the Maven home. It's the folder for user-specific configuration and local repository. I corrected the question's title acordingly.

Upvotes: 7

Related Questions