jdk1.7升级到jdk1.8后出错: [ERROR] javadoc: warning - Multiple sources of package comments found for package
from: http://blog.joda.org/2014/02/turning-off-doclint-in-jdk-8-javadoc.html
[ERROR] javadoc: warning - Multiple sources of package comments found for package
Turning off doclint in JDK 8 Javadoc
JDK 8 includes many updates, but one is I suspect going to cause quite a few complaints - doclint for Javadoc.
Javadoc doclint
Documentation is not something most developers like writing. With Java, we were fortunate to have the Javadoc toolset built in and easy to access from day one. As such, writing Javadoc is a standard part of most developers life.
The Javadoc comments in source code use a mixture of tags, starting with @, and HTML to allow the developer to express their comment and format it nicely.
Up to JDK 7, the Javadoc tool was pretty lenient. As a developer, you could write anything that vaguely resembled HTML and the tool would rarely complain beyond warnings. Thus you could have @link references that were inaccurate (such as due to refactoring) and the tool would simply provide a warning.
With JDK 8, a new part has been added to Javadoc called doclint and it changes that friendly behaviour. In particular, the tool aim to get conforming W3C HTML 4.01 HTML (despite the fact that humans are very bad at matching conformance wrt HTML).
With JDK 8, you are unable to get Javadoc unless your tool meets the standards of doclint. Some of its rules are:
- no self-closed HTML tags, such as <br /> or <a id="x" />
- no unclosed HTML tags, such as <ul> without matching </ul>
- no invalid HTML end tags, such as </br>
- no invalid HTML attributes, based on doclint's interpretation of W3C HTML 4.01
- no duplicate HTML id attribute
- no empty HTML href attribute
- no incorrectly nested headers, such as class documentation must have <h3>, not <h4>
- no invalid HTML tags, such as List<String> (where you forgot to escape using <)
- no broken @link references
- no broken @param references, they must match the actual parameter name
- no broken @throws references, the first word must be a class name
Note that these are errors, not warnings. Break the rules and you get no Javadoc output.
In my opinion, this is way too strict to be the default. I have no problem with such a tool existing in Javadoc, but given the history of Javadoc, errors like this should be opt-in, not opt-out. Its far better to get slightly broken Javadoc than no Javadoc.
I also haven't been able to find a list of the rules, which makes life hard. At least we can see the source code to reverse engineer them.
Turning off doclint
The magic incantation you need is -Xdoclint:none. This goes on the command line invoking Javadoc.
If you are running from maven, you need to use the additionalparam setting, as per the manual. Either add it as a global property:
<properties>
<additionalparam>-Xdoclint:none</additionalparam>
</properties>
or add it to the maven-javadoc-plugin:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</plugin>
</plugins>
Ant also uses additionalparam to pass in -Xdoclint:none, see the manual.
Gradle does not expose additionalparam but Tim Yates and Cedric Champeau advise of this solution:
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
See also the Gradle manual.
Summary
I don't mind doclint existing, but there is no way that it should be turned on to error mode by default. Getting some Javadoc produced without hassle is far more important than pandering to the doclint style checks. In addition, it is very heavy handed with what it defines to be errors, rejecting plenty of HTML that works perfectly fine in a browser.
I've asked the maven team to disable doclint by default, and I'd suggest the same to Ant and Gradle. Unfortunately, the Oracle team seem convinced that they've made the right choice with errors by default and their use of strict HTML.
Comments welcome, but please note that non-specific "it didn't work for me" comments should be at Stack Overflow or Java Ranch, not here!
jdk1.7升级到jdk1.8后出错: [ERROR] javadoc: warning - Multiple sources of package comments found for package的更多相关文章
- jdk1.6 升级到 jdk1.7
将 jdk1.6 升级到 jdk1.7 下载jdk-7u11-linux-x64.tar.gz tar zxvf jdk-7u11-linux-x64.tar.gz mkdir /usr/l ...
- PInvoke在 2.0 3.0的时候正常 升级到4.0后出错。
方法1: 设置 CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl,但是我设置了也是出错.换一个con ...
- 一次jdk1.7升级jdk1.8后导致redis运行时blocked_clients过多问题解决
公司有个采集项目,因为请求量较大,添加了redis集群,并且升级了原有的jdk1.7到jdk1.8版本,之后问题就出来了. 1.程序运行一段时间就自动停止,必须重启才能再次运行. 2.redis连接监 ...
- 解决Spring Boot 从1.x升级到 2.x 后 单点登陆(SSO)问题
解决Spring Boot 从1.x升级到 2.x 后 单点登陆(SSO)问题 在学习Spring Cloud 时,遇到了授权服务oauth 相关内容时,总是一知半解,因此决定先把Spring S ...
- mysql从5.6升级到5.7后出现 Expression #1 of ORDER BY clause is not in SELECT list,this is incompatible with DISTINCT
[问题]mysql从5.6升级到5.7后出现:插入数据和修改数据时出错Caused by: com.ibatis.common.jdbc.exception.NestedSQLException: - ...
- SharePoint 2010升级到sharePoint 2013后,人员失去对网站的权限的原因及解决方法。The reason and solution for permission lost after the upgrading
昨天碰到了一个问题,一个网站在从SharePoint 2010升级到SharePoint 2013后,人员都不能登录了,必须重加赋权,人员才能登录,这样非常麻烦. 原因:是认证方式的问题.在Share ...
- 升级10.11.6后CocoaPods的坑,之前10.11.4已经安装好的,居然没了Failed to locate Homebrew!
升级10.11.6后CocoaPods的坑,之前10.11.4已经安装好的,居然没了,用命令 sudo gem install cocoapod 装不上,换 sudo gem install -n/u ...
- 升级xcode6和ios8后,unity遇到的一些小问题
升级最新的Xocde6后,如果不是最新版本的unity,虽然也可以也可以正常的build,但如果想通过unity连真机进行profile的话,就会在xocde中报错,这个的主要原因是unity的配置里 ...
- xcode7.3 升级 xcode8.0 后权限设置问题(升级xcode 8.0 后构建版本不显示问题)
xcode7.3 升级 xcode8.0 后权限设置问题(升级xcode 8.0 后构建版本不显示问题) 前两天为了适配 iOS10 的系统 我将xcode 7.3 升级到了 xcode 8.0 但是 ...
随机推荐
- CKRule BRMS-决策表使用说明
决策表的编辑有2个步骤,即规则包编辑.规则数据设置和发布. 1. 规则包编辑 双击CKBoot.exe打开CKRule规则引擎编辑界面.点新建,在左侧的工程窗口中,就会出现一个新的规则包.点击根结 ...
- Java语言----三种循环语句的区别
------- android培训.java培训.期待与您交流! ---------- 第一种:for循环 循环结构for语句的格式: for(初始化表达式;条件表达式;循环后的操作表达式 ...
- 使用C++11安全的在线程中控制UI
本篇文章由:http://www.sollyu.com/using-the-c11-secure-online-process-control-ui/ 说明 首先这里使用的是 Visual Studi ...
- Android NDK 环境搭建 + 测试例程
懒得废话一大堆概念,关于ADT.NDK的概念要是你不懂,怎么会搜到这里来?所以你只需要根据下面的步骤来,就可以完成NDK环境搭建了. 步骤:(假设你未安装任何相关开发工具,如果已经安装了,就可以跳过) ...
- MongoDB的timezone问题
MongoDB是以UTC格式来存储所有时间的,查询的时候也是返回UTC时间,不提供在数据库连接级别的timezone支持,这就带来一个问题:无法使用groupby对日期进行聚合,因为你所在的timez ...
- ssh自动登录的4种实现方法
ssh自动登录的几种实现方法,记录在此. 1. 自动ssh/scp方法 A为本地主机(即用于控制其他主机的机器) ; B为远程主机(即被控制的机器Server), 假如ip为192.168.60.1 ...
- SQL技术内幕二DDL
创建数据库: if db_id('DBTest') is nullcreate database DBTest 创建表 use eb_fy_data_test---use 切换所在数据库上下文 if ...
- JAVA学习资料整理
今天偶然间发现之前一个群里发过的一篇关于JAVA学习资料的东西.本着服务大众的精神,搬来了博客园: <JAVA编程思想>第四版(英文原版) 下载地址:http://115.com/file ...
- 视频边下边播--缓存播放数据流-b
google搜索“iOS视频变下边播”,有好几篇博客写到了实现方法,其实只有一篇,其他都是copy的,不过他们都是使用的本地代理服务器的方式. 原理很简单,但是缺点也很明显,需要自己写一个本地代理服务 ...
- 计算S(n)=a+aa+aaa+...... 其中a是一个数字
描述 计算S(n)=a+aa+aaa+...... 其中a是一个数字 输入数据 两个分别表示a和n的整数 输出数据 一个表示S(n)的整数 输入示例 3 5 输出示例 37035 # include ...