Rob Avery IV
Rob Avery IV

Reputation: 3720

Maven: Is it possible to have more than one settings.xml files?

I have a multimodule project. All of the modules, but one are different. There are some things in the settings.xml file that I want to be different in the one module than from the rest.

Is it possible to have two settings.xml file and use them for different modules?

Upvotes: 0

Views: 1319

Answers (2)

chad
chad

Reputation: 7519

Think of the settings.xml as the configuration for your installation of maven. It determines the behavior of maven across it's use in your various projects.

This being said, if an individual project, i.e. a pom, requires something unique, it should be in that pom.

I think the thing to remember is that the project should be able to build on an individual dev's machine without any special intervention. In other words, the ideal case is that a given pom can successufl execute mvn install in a vanilla environment. So, don't put something in it that requires tweaking for a dev to get it to work. Also don't put anything in your settings.xml that enables a project to build, but then puts the burden on other devs to know what secrets are in your settings.xml.

Upvotes: 2

mortsahl
mortsahl

Reputation: 602

You can set up different things in your individual pom files. What's in the pom files will override what's in settings. For instance, if your child poms sets up different repositories they'll be used over what is defined in settings.xml. Settings.xml is the default is nothing else applies. Depending on exactly what you want to do you might also take a look at the profiles feature.

Upvotes: 0

Related Questions