Integration with Maven: Definition

It depends on what technology you have chosen to store property definitions, how to configure your application. In this short tutorial we show

  1. Read-only properties on the classpath
  2. Properties in an SQL database

Module Dependencies

If you have modules with property declarations (see Integration with Maven: Declaration for details on how to create one), add the dependencies to these artifacts as usual:

<dependency>
  <groupId>com.example.mycorporation</groupId>
  <artifactId>module-mail</artifactId>
</dependency>
<dependency>
  <groupId>com.example.mycorporation</groupId>
  <artifactId>module-epayment</artifactId>
</dependency>

Since each of these modules contains a declaration.xml, the system will register the property descriptors found therein.

This step is agnostic to the technology you choose to store your property definitions.

Read-only properties on the classpath

It is easy to separate the property set definitions from the rest of the code and add the static properties to the classpath (in this case all properties are required to be read-only). E.g.:

<dependency>
  <groupId>com.example.mycorporation</groupId>
  <artifactId>my-application-config-production</artifactId>
</dependency>

Note: If you want also have write-access to your properties you have to choose a configuration implementation that may manage the properties in a persistent backend store.

Properties in an SQL database

If your want to access properties in an SQL database, you have to decide how the property definitions are transferred to that database.

One option is to create a project where you manage the property values as above, but instead of deploying the archive with the properties to the classpath, export them to the database. The export can be done directly to the database or you create a SQL script that can be executed on the target platform.

For configuration options please refer to Property Sinks of the smartics-properties-maven-plugin.