Moved into Framework Libraries from its original location as a project in Common Platform. For previous versions please refer here.
This project contains a plugin for validating annotations. Currently, it has two purposes (and they are optionally controlled):
- Report generation - the plugin can be configured to run in the background to surface validation failures in the form of a CSV report. This report is generated per annotation on which validation is performed
- Fail build - Enforce build failure if validation fails
| Parameter | Description |
|---|---|
| generateReport | (Boolean) Generates report per annotation class using format (annotation-plugin-validation-result-{package.annotation-class-name}.csv in the base director path for the module |
| failBuildOnError | (Boolean) Fails build on encountering validation errors if set to true |
| serviceName | (String) Name of the service against which plugin validation is being executed |
| validationSkip | (Boolean) Skips annotation validation in its entirety if set to true |
| annotations.annotation | (List) fully qualified class names for annotations |
The module provides the API for implementing validators for specific annotation classes.
The following dependency will need to included
<dependency>
<groupId>uk.gov.justice.maven</groupId>
<artifactId>annotation-validator-core</artifactId>
<version>LATEST</version>
</dependency>Create an implementation of uk.gov.justice.maven.annotation.validator.AnnotationValidator interface. This is a typed interface which is tied a specific annotation class type.
Sample configuration to generate validation report for a specific annotation (e.g., uk.gov.justice.domain.annotation.Event:
<build>
<plugins>
<plugin>
<groupId>uk.gov.justice.maven</groupId>
<artifactId>annotation-validator-maven-plugin</artifactId>
<version>LATEST</version> <!-- pick a suitable version -->
<configuration>
<generateReport>true</generateReport>
<failBuildOnError>false</failBuildOnError>
<serviceName>structure</serviceName>
<validationSkip>false</validationSkip>
<annotations>
<annotation>uk.gov.justice.domain.annotation.Event</annotation>
</annotations>
</configuration>
</plugin>
</plugins>
</build>- Refactor plugin to separate out framework specific validation logic