/maven-javadoc-spellchecker

A pom.xml file which uses the SpellCheckDocklet to spell check Javadoc from Maven

MIT LicenseMIT

maven-javadoc-spellchecker

A pom.xml file which uses the SpellCheckDocklet to spell check Javadoc from Maven. Inspired by this answer on StackOverflow.

Versioning

This project consists of a single file, spellcheck-pom.xml. As such, it's not versioned per se beyond the versioning provided by git.

Prerequisites

Invoking as a separate pom file

This is a quick and easy way to spell check a project with no dependencies.

  1. Copy spellcheck-pom.xml to your project directory
  2. Copy the dependencies from your pom file into the spellcheck pom file.
  3. Update the properties containing the paths to Jazzy, SpellCheckDoclet, your personal ignore words list, and any project-specific ignore words list
    • spchk.doclet.path: path-to-SpellCheckDoclet
    • spchk.jazzy.path: path-to-Jazzy
    • spchk.user.ignoreFile: path-and-filename-for-user-ignore-list.txt
    • spchk.project.ignoreFile: path-and-filename-for-project-ignore-word-list.txt
  4. If you are not using a user-specific or project-specific ignore word list, delete the the corresponding arguments from the javadoc plugin's additionalOptions section.
  5. If you are using JDK 8 by default, delete the entire maven-toolchain-plugin plugin section. Perform the spellcheck using mvn -f spellcheck-pom.xml javadoc:javadoc The results will be written to target/site/spellcheck/CheckDoc.txt

Adding SpellCheckDoclet to your pom file

If your project has dependencies, this is a better way to go.

  1. Create a new profile, assumed here to be called "spellcheck", and copy the contents of the properties and build sections from spellcheck-pom.xml into your pom file. You should omit the toolchain plugin section if your default JDK is Java 8.
  2. Update the properties containing the paths to Jazzy, SpellCheckDoclet, your personal ignore words list, and any project-specific ignore words list
    • spchk.doclet.path: path-to-SpellCheckDoclet
    • spchk.jazzy.path: path-to-Jazzy
    • spchk.user.ignoreFile: path-and-filename-for-user-ignore-list.txt
    • spchk.project.ignoreFile: path-and-filename-for-project-ignore-word-list.txt
  3. If you are not using a user-specific or project-specific ignore word list, delete the the corresponding arguments from the javadoc plugin's additionalOptions section. Perform the spellcheck using mvn -P spellcheck javadoc:javadoc The results will be written to target/site/spellcheck/CheckDoc.txt

Structure of pom file after adding spellcheck-pom.xml sections - with Java 8 toolchain for default JDK > Java 8

...
<profiles>
  <profile>
    <id>spellcheck</id>

    <properties>
      ...
    </properties>

    <build>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-toolchains-plugin</artifactId>
          <version>3.0.0</version>
          <executions>
            <execution>
              <goals>
                <goal>toolchain</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <toolchains>
              <jdk>
                <version>1.8></version>
              </jdk>
            </toolchains>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.1.1</version>
          <configuration>
            <doclet>spellcheck.SpellCheckDoclet</doclet>
            <docletPath>${spchk.doclet.cp}:${spchk.jazzy.cp}</docletPath>
            <echo>on</echo>
            <reportOutputDirectory>${project.reporting.outputDirectory}</reportOutputDirectory>
            <destDir>spellcheck</destDir>
            <useStandardDocletOptions>false</useStandardDocletOptions>
            <additionalOptions>...</additionalOptions>
          </configuration>
        </plugin>
      </plugins>
    </build>
  </profile>
</profiles>
...

Structure of pom file after adding spellcheck-pom.xml sections - Java 8 as default JDK

...
<profiles>
  <profile>
    <id>spellcheck</id>

    <properties>
      ...
    </properties>

    <build>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.1.1</version>
          <configuration>
            <doclet>spellcheck.SpellCheckDoclet</doclet>
            <docletPath>${spchk.doclet.cp}:${spchk.jazzy.cp}</docletPath>
            <echo>on</echo>
            <reportOutputDirectory>${project.reporting.outputDirectory}</reportOutputDirectory>
            <destDir>spellcheck</destDir>
            <useStandardDocletOptions>false</useStandardDocletOptions>
            <additionalOptions>...</additionalOptions>
          </configuration>
        </plugin>
      </plugins>
    </build>
  </profile>
</profiles>
...