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 但是 ...
随机推荐
- percent-encode 百分号编码
原文地址:http://www.imkevinyang.com/2009/08/详解javascript中的url编解码.html 摘要 URI(统一资源标识)编解码 为什么需要编码 哪些需要编码 如 ...
- C#嵌套类型
1.什么是嵌套类型:在类和结构内部定义的类型称为嵌套类型,例如 class Container { class Nested { Nested() { } } } 2.不管外部类型是结构还是类.嵌套类 ...
- 使用FreeMarker生成静态HTML
1.FreeMarker需要添加的Maven依赖: <dependency> <groupId>org.freemarker</groupId> <artif ...
- bzoj4637:期望
思路:最小生成树计数只不过加了一个期望,由于期望具有线性性质,就可以转化为每条边的期望之和,那么一条边的期望如何求呢,在最小生成树记数中,是把相同边权的一起处理,之后把属于连通块内的点缩点,也就是说, ...
- [java学习笔记]java语言基础概述之标识符&关键字&注释&常量和变量
一.标识符 在程序中自定义的一些名称 由26个英文字母的大小写,数字,_$组成 定义合法标识符的规则: 不能以数字开头 不能使用关键字 java严格区分大小写 注意:在起名字时,为了提高阅读性,必须得 ...
- 如何将C++中的SOCKADDR_IN*参数类型转换成C#中的参数类型
将C++中的参数类型SOCKADDR_IN*映射为C#中的IntPtr参数类型的示例代码如下: IntPtr ptrSockaddr = new IntPtr(); //ip地址 sockaddr_i ...
- python 自动化之路 day 04
内容目录: 1. 函数基本语法及特性 2. 参数与局部变量 3. 返回值 4.嵌套函数 5.递归 6.匿名函数 7.函数式编程介绍 8.高阶函数 9.内置函数 1.函数基本语法及特性 背景提要 现在老 ...
- 链表C++模板实现
#include <iostream.h> #include <stdlib.h> //结点模板类 template <typename t1, typename t2& ...
- 摘自淘宝的js地区组件
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- Delphi中的GetEnumName和GetEnumValue的使用方法
利用TypInfo单元的GetEnumName和GetEnumValue可以遍历任意枚举类型,并获取其名称和值.下面是示例Demo. uses TypInfo; ... procedure TForm ...