stephanos
stephanos

Reputation: 3339

How to share database properties in Maven 3 multi modules projects?

Let's assume there are 2 applications. The POM hierarchy might look like this:

   parent
   --> system A
   --> system B

Both systems are supposed to be able to connect to the same database.

Each system has 2 profiles: Development (embedded DB) and Production (MySQL).

How can I use Maven to share the database connection information (user, path, driver etc.) for each profile ACROSS BOTH systems (I'm using resource filtering)?

Upvotes: 1

Views: 920

Answers (2)

pavel_kazlou
pavel_kazlou

Reputation: 2046

Take care when deciding where database connection information will be stored. While it's ok to store driver and url in pom.xml (so this info probably goes to source repository and can be accessed by anyone who is granted access to the source), username and password should not be exposed usually. So they are better specified in settings.xml. This is especially important in your case, when you work with production database. Nice explanation can be found here

Upvotes: 2

khmarbaise
khmarbaise

Reputation: 97348

Just store the properties for those information in the appropriate profile.

Upvotes: 0

Related Questions