vnu-maven-plugin

Maven plugin to validate HTML / CSS / SVG files with the NU HTML Checker (v.NU, https://validator.github.io/validator/)

License

License

Categories

Categories

Maven Build Tools
GroupId

GroupId

nu.validator
ArtifactId

ArtifactId

vnu-maven-plugin
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

vnu-maven-plugin
Maven plugin to validate HTML / CSS / SVG files with the NU HTML Checker (v.NU, https://validator.github.io/validator/)
Project URL

Project URL

https://github.com/validator/maven-plugin
Source Code Management

Source Code Management

https://github.com/validator/maven-plugin

Download vnu-maven-plugin

How to add to project

<plugin>
    <groupId>nu.validator</groupId>
    <artifactId>vnu-maven-plugin</artifactId>
    <version>1.0.0</version>
</plugin>

Dependencies

compile (4)

Group / Artifact Type Version
org.apache.maven : maven-plugin-api jar 3.6.3
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.5.2
org.apache.maven : maven-core jar 3.6.3
nu.validator : validator jar 20.7.2

Project Modules

There are no modules declared in this project.

nvu-maven-plugin

maven plugin for HTML validation, using the Nu Html Checker (v.Nu)

The plugin can be configured to be run in the valdiation phase of the maven build and cause the build to fail in case errors are reported.

Usage

Add the plugin to your pom.xml:

<build>
    <plugins>
        <plugin>
            <groupId>nu.validator</groupId>
            <artifactId>vnu-maven-plugin</artifactId>
            <version>1.0.0</version>

            <!-- The plugin should hook into the validate goal -->
            <executions>
                <execution>
                    <goals>
                        <goal>validate</goal>
                    </goals>
                </execution>
            </executions>

            <configuration>
                <filesets>
                    <fileset>
                        <directory>...</directory>
                        ...
                    </fileset>
                </filesets>
                [<validator>...</validator>]
            </configuration>
        </plugin>
    </plugins>
</build>

The configuration is also made in the pom.xml. There are defaults in place, you only need to configure at least one fileset to point to the files to be validated.

The fileset configuration consists of a directory (relative to the maven project root) and an optional ant glob directive to filter the contents of the directory. Directories are scanned recursively by default. Example:

<fileset>
    <directory>src/main/resources/templates</directory>
    <glob>**.html</glob>
</fileset>

The validator can also be configured:

<validator>
    <warnings>WARN</warnings>
    <forceType>HTML</forceType>
    <filters>
        <filter>
            ...
        </filter>
    </filters>
</validator>

Here, all settings are optional.

Handling warnings

By default, warnings are displayed as such and don't cause the build to fail. It can be configured through the directive:

  • WARN (default) - show warnings
  • IGNORE - supress warnings
  • ERROR - treat as errors (affects filtering, see below)

Forcing file type

By default, the file type (html/xhtml, css, svg) is determined by the file extension. Through the directive, it is possible to force all files to be considered on of types HTML, CSS, SVG or XHTML.

Filtering

It is possible to filter warnings and/or errors based on (WARN, ERROR, ALL, optional, default ALL) and a . Filtered items are completely ignored. Mutiple filters can be configured. Example:

<filter>
    <regex>Duplicate ID "[a-zA-Z0-9.]*"</regex>
    <type>ERROR</type>
</filter>

Additional (general) options

Failfast

Fail on first error (default is to process all errors and fail in the end if there are errors)

<failfast>true</failfast>

ASCII / Unicode quotes

By default, quotes in the errors messages will be displayed as ASCII quotes. It is possible to switch to unicode quites by setting this option to 'false'

<asciiquotes>false</asciiquotes>
nu.validator

The Nu Html Checker

Helps you catch unintended mistakes in your HTML, CSS, and SVG

Versions

Version
1.0.0
0.0.3
0.0.2
0.0.1