Fork me on GitHub

Validators

Overview

With the goals validate-package and validate-files it is possible to run validation on top of the given package or the package source files. Validation itself is implemented with the Jackrabbit FileVault Validation Framework which also contains a lot of standard validators. Look there on which validators are contained and what options they provide.

Configuration

It is possible to adjust every validator registered in the system (both default and external validators) with the parameter validatorsSettings. This is a map with the keys being the validator ids (and optionally suffixed by :<package group>:<package name> to restrict to only certain package ids) and the values being complex objects. Here is an example configuration

<configuration>
  <validatorsSettings>
    <jackrabbit-filter>
      <isDisabled>false</isDisabled><!-- false is default, true disables the validator completely, all other setting are not relevant then -->
      <defaultSeverity>error</defaultSeverity>
      <options>
        <severityForUncoveredAncestorNodes>error</severityForUncoveredAncestorNodes>
      </options>
    </jackrabbit-filter>
    <!-- succeeding items potentially overwrite preceding items -->
    <jackrabbit-filter:mygroup:mypackage>
      <isDisabled>true</isDisabled><!-- disable the validator for a specific package -->
    </jackrabbit-filter>
  </validatorsSettings>
</configuration>

The options for the individual validators together with the validator ids are documented at Jackrabbit FileVault Validation Framework.

Severities

The validation message severities have an impact on the build outcome. By default every validation message with severity error will fail the build. One can adjust this setting by leveraging the configuration parameter failOnValidationWarnings.

Dependencies

All package dependencies are resolved via the Maven Artifact Resolver. If package dependencies are only given via their package id a best guess resolution is tried by using the name as artifactId and group as groupId. You can tweak this fallback behaviour by leveraging the configuration parameter mapPackageDependencyToMavenGa.

Reference External Validators

To reference an external validator it just needs to be given as plugin dependency to the filevault-package-maven-plugin.

<plugin>
  <groupId>org.apache.jackrabbit</groupId>
  <artifactId>filevault-package-maven-plugin</artifactId>
  <dependencies>
    <!-- some validator extension -->
    <dependency>
      <artifactId>myartifact</artifactId>
      <groupId>mygroup</groupId>
      <version>1.0.0</version>
    </dependency>
  </dependencies>
</plugin>