当代码具有不完整的java doc标签时,Maven站点因Java 8而失败

时间:2018-01-22 01:45:18

标签: java maven java-8 javadoc

我已经从Java 7迁移到Java 8.当我执行mvn install时,我的构建成功了。但是当我执行mvn site时,网站生成失败了:

  

[错误]无法执行目标   org.apache.maven.plugins:maven-site-plugin:3.4:site(default-site)on   项目XXXXXX:生成错误   行家-Javadoc的插件:2.8:测试的Javadoc:

以下是我的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>

我们的测试中有一些没有文档的Javadoc标记。我试图实现这篇文章中提到的解决方案:

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

不幸的是,这对我不起作用,或者我没有以正确的方式做到这一点。有人可以告诉我如何在没有文档的情况下告诉Maven忽略Javadoc标签吗?

谢谢!

1 个答案:

答案 0 :(得分:2)

在maven-javadoc-plugin配置中添加以下额外的param标签

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

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