Search code examples
javamavenjava-8javadoc

Maven site fails with Java 8 when code has incomplete java doc tags


I have migrated from Java 7 to Java 8. My build succeeds when I do a mvn install. But when I do a mvn site, the site generation fails saying:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.4:site (default-site) on project XXXXXX: Error generating maven-javadoc-plugin:2.8:test-javadoc:

Below is my pom.xml

<build>

    <pluginManagement>

        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.2</version>
                <configuration>
                    <source>${jdk.version}</source>
                    <target>${jdk.version}</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.4</version>
            </plugin>


        </plugins>

    </pluginManagement>

    <plugins>

</build>

<reporting>

    <plugins>

        <!-- Javadoc report -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.8</version>
            <configuration>
                <charset>UTF-8</charset>
                <docencoding>UTF-8</docencoding>
                <docfilessubdirs>true</docfilessubdirs>
                <source>${jdk.version}</source>
                <show>protected</show>
                <detectLinks>true</detectLinks>
            </configuration>
        </plugin>

        <!-- A Javadoc link and the generated code documentation. -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-project-info-reports-plugin</artifactId>
            <version>2.7</version>
            <configuration>
                <dependencyDetailsEnabled>false</dependencyDetailsEnabled>
                <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
                <showAvatarImages>false</showAvatarImages>
            </configuration>
            <reportSets>
                <reportSet>
                    <reports>
                        <report>index</report>
                        <report>summary</report>
                        <report>issue-tracking</report>
                        <report>project-team</report>
                        <report>cim</report>
                        <report>dependencies</report>
                        <report>dependency-convergence</report>
                        <report>scm</report>
                    </reports>
                </reportSet>
            </reportSets>
        </plugin>

        <!-- Surefire report -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-report-plugin</artifactId>
            <version>2.18.1</version>
        </plugin>

        <!-- Findbugs report -->
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>findbugs-maven-plugin</artifactId>
            <version>3.0.1</version>
            <configuration>
                <effort>Max</effort>
                <threshold>Medium</threshold>
            </configuration>
        </plugin>


        <!-- Checkstyle report -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-checkstyle-plugin</artifactId>
            <version>2.15</version>
            <reportSets>
                <reportSet>
                    <reports>
                        <report>checkstyle</report>
                    </reports>
                </reportSet>
            </reportSets>
        </plugin>

        <!-- Changes Report -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-changes-plugin</artifactId>
            <version>2.12</version>
            <configuration>
                <useJql>true</useJql>
                <!-- Version =>1.0-alpha-2 (23505) -->
                <fixVersionIds>23505</fixVersionIds>
                <statusIds>Resolved, Closed</statusIds>
                <resolutionIds>Fixed, Complete</resolutionIds>
                <columnNames>Type,Key,Summary,Assignee,Status,Resolution,Fix
                    Version</columnNames>
                <sortColumnNames>Type</sortColumnNames>
            </configuration>
        </plugin>

    </plugins>

</reporting>

<profiles>

</profiles>

There are some Javadoc tags in our tests which does not have documentation. I have tried to implement the solutions mentioned in this post:

Maven is not working in Java 8 when Javadoc tags are incomplete

Unfortunately this was not working for me or maybe I am not doing it the correct way. Could someone suggest me how I can tell Maven to ignore Javadoc tags without documentation?

Thank you!


Solution

  • Add the below additional param tag the the maven-javadoc-plugin configuration

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <additionalparam>-Xdoclint:none</additionalparam>
                </configuration>
            </plugin>
        </plugins>
    

    Reference: http://blog.joda.org/2014/02/turning-off-doclint-in-jdk-8-javadoc.html