当代码具有不完整的 java doc 标签时,Maven 站点因 Java 8 而失败
Posted
技术标签:
【中文标题】当代码具有不完整的 java doc 标签时,Maven 站点因 Java 8 而失败【英文标题】:Maven site fails with Java 8 when code has incomplete java doc tags 【发布时间】:2018-06-30 14:49:56 【问题描述】:我已从 Java 7 迁移到 Java 8。当我执行 mvn install
时,我的构建成功。但是当我执行mvn site
时,网站生成失败说:
[ERROR] 未能执行目标 org.apache.maven.plugins:maven-site-plugin:3.4:site (default-site) on 项目 XXXXXX:生成错误 maven-javadoc-plugin:2.8:test-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】:在 maven-javadoc-plugin 配置中添加以下附加参数标记
<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
【讨论】:
以上是关于当代码具有不完整的 java doc 标签时,Maven 站点因 Java 8 而失败的主要内容,如果未能解决你的问题,请参考以下文章
java 利用jsoup 如何去除一段代码中的所有html标签,只留纯文本
锚标签有一半的链接,但是当我点击链接时,它会打开一个包含完整链接的新页面
使用 std::unique_ptr 的 C++ Pimpl Idiom 不完整类型
在python tkinter中调用事件时,变量不更新的标签