Skip to content

Latest commit

 

History

History
205 lines (170 loc) · 5.27 KB

File metadata and controls

205 lines (170 loc) · 5.27 KB

HSC Maven Plugin

Maven Plugin Portal Version Maven Central Version

The {maven-url}[Maven] plugin of HTML Sanity Check (HSC) enables to check generated or native HTML documentation from the Maven build.

Installation (Maven Plugin)

Default Installation

Use the following snippet inside a Maven build file:

build.maven
<plugin>
    <groupId>org.aim42.htmlSanityCheck</groupId>
    <artifactId>htmlSanityCheck-maven-plugin</artifactId>
    <version>{hsc-version}</version> // (1)
    <executions>
        <execution>
            <phase>compile</phase>
            <goals>
                <goal>sanity-check</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <sourceDocuments>
            <file>src/file-to-test.html</file> (2)
        </sourceDocuments>
        <sourceDir>src</sourceDir> (3)
    </configuration>
</plugin>
  1. Checkout current version

  2. List the files you want tio check here.

  3. Directory where the HTML files are located.

Important
Latest (development) versions

Usage

This task exposes a few properties as part of its configuration:

sourceDir (mandatory)

Directory where the HTML files are located.

Type: Directory.

sourceDocuments (optional)

An override to process several source files, which may be a subset of all files available in {sourceDir}.

Type: org.maven.api.file.FileCollection.

Default: All files in {sourceDir} whose names end with .html.

checkingResultsDir (optional)

Directory where the checking results written to.

Type: Directory.

Default: {buildDir}/reports/htmlSanityCheck/

junitResultsDir (optional)

Directory where the results are written to in JUnit XML format. JUnit XML can be read by many tools, including CI environments.

Type: Directory.

Default: {buildDir}/test-results/htmlchecks/

failOnErrors (optional)

Fail the build if any error was found in the checked pages.

Type: Boolean.

Default: false.

httpConnectionTimeout (optional)

Timeout for http requests in ms.

Type: Integer.

Default: 5000.

ignoreLocalHost (optional)

Ignore localhost as hostname.

Type: Boolean.

Default: false.

ignoreIPAddresses (optional)

Ignore IP addresses as hostname.

Type: Boolean.

Default: false.

checkerClasses (optional)

The set of checker classes to be executed.

Type: List.

Default: All available checker classes.

Checker Classes
link:../htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/check/AllCheckers.java[role=include]
httpWarningCodes (optional)

Additional HTTP response codes treated as warning.

Type: List.

Default:

link:../htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/tools/Web.java[role=include]
// Redirects included
link:../htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/tools/Web.java[role=include]
Note
HTTP Redirects

Note that HTTP redirects are treated as a warning to make the user aware of the correct or new location (cf. {project-issues}/244[Issue 244]). Some HSC reports often contain the respective location.

httpErrorCodes (optional)

Additional HTTP response codes treated as error.

Type: List.

Default:

link:../htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/tools/Web.java[role=include]
httpSuccessCodes (optional)

Additional HTTP response codes treated as success.

Type: List.

Default:

link:../htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/tools/Web.java[role=include]
HTTP response code handling

The lists shown above are the default HTTP response codes handled by HSC. The mentioned configurations effectively move the configured codes around, i.e., if you add 308 to httpErrorCodes it is automatically removed from its default list (httpWarningCodes).

Examples

Small Example

build.maven

tbd

Extended example

build.maven
tbd

Compatibility

The Plugin is only tested with Maven 3.9.x, but should also work with previous versions later than Maven 3.6.x.