Maven Enforcer Plugin, Custom Rule: Property Usage
Maven Enforcer Plugin provides goals to control certain environmental constraints such as Maven version, JDK version and OS family along with many more standard rules and user created rules.
This project, artifact property-usage-rule, is a user created custom rule to verify the usage of defined properties in the source files of the build.
Rationale
It often happens during development that different properties are defined and used, and then taken out of use but definition is forgotten; they get “left behind” in the resources/*.properties file. This Maven Enforcer rule allows the build to verify these following:
- All properties which are defined in properties files, are also used in the source code.
- All properties used in the source code are also defined in properties files.
- No property is defined more than once in properties files.
- When used properties are extracted from the source code, a project policy can be forced:
- on property name…
- on how to access them (via Spring Placeholders, via getProperty, etc.)…
- … via regexp-sentences.
- To know more about the rule’s configuration and parameters, check the Configuration page.
- For a quick adoption of the Enforcer rule, check the Usage page.
- Released builds are available from Maven Central.