Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

User and project specific settings in Maven

We develop multiple branches of a project concurrently. Each developer has multiple working copies, each working copy uses its own DB schema. (There will typically be a working copy per branch, but sometimes even more than one working copy per branch.) We need to let Maven know the DB credentials (for the db-migration plugin, for unit tests, for the dev instance of the servlet).

We can't put the credentials in the pom.xml because each developer might use different DB schema names. We can't put the credentials in settings.xml because each developer uses more than one schema.

Where do we put the credentials?

For example, http://code.google.com/p/c5-db-migration/ describes that the DB credentials need to be present in pom.xml but I would like to externalize them out to a file that's not under revision control.

like image 347
hibbelig Avatar asked Mar 07 '11 18:03

hibbelig


1 Answers

You could put them into a properties file inside the project directory but which is excluded from source control.

With Maven it's possible to read properties from an external file by using a <build><filters><filter> element as instructed here.

like image 159
Esko Luontola Avatar answered Oct 04 '22 22:10

Esko Luontola