Skip to content
This repository has been archived by the owner on May 26, 2020. It is now read-only.

CJSCommonPlatform/annotation-validator-maven-plugin

Repository files navigation

Annotation Validator Maven Plugin


Deprecated

This project has moved to be a sub-project of Framework Libraries and is located here

Pull requests against this project have been disabled. Please contact one of the project owners for emergency bug fixes on this version


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

Plugin configuration parameters

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

Extending plugin usage

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.

Usage

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>

Further work

  • Refactor plugin to separate out framework specific validation logic

About

Plugin for performing validation on annotation classes

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages