From notifications-return-5295-archive-asf-public=cust-asf.ponee.io@yetus.apache.org Fri Apr 13 16:17:06 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 1E45018067B for ; Fri, 13 Apr 2018 16:17:05 +0200 (CEST) Received: (qmail 89099 invoked by uid 500); 13 Apr 2018 14:17:05 -0000 Mailing-List: contact notifications-help@yetus.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@yetus.apache.org Delivered-To: mailing list notifications@yetus.apache.org Received: (qmail 89086 invoked by uid 99); 13 Apr 2018 14:17:05 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Apr 2018 14:17:05 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id CF63CC00A6 for ; Fri, 13 Apr 2018 14:17:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -110.311 X-Spam-Level: X-Spam-Status: No, score=-110.311 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id EAUHpdIIIlEa for ; Fri, 13 Apr 2018 14:17:03 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 5C4B46103A for ; Fri, 13 Apr 2018 14:17:02 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id F0B2EE0C55 for ; Fri, 13 Apr 2018 14:17:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 52044241D2 for ; Fri, 13 Apr 2018 14:17:00 +0000 (UTC) Date: Fri, 13 Apr 2018 14:17:00 +0000 (UTC) From: "Grant Henke (JIRA)" To: notifications@yetus.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (YETUS-627) Doclet does not work with Gradle Javadoc generation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Grant Henke created YETUS-627: --------------------------------- Summary: Doclet does not work with Gradle Javadoc generation Key: YETUS-627 URL: https://issues.apache.org/jira/browse/YETUS-627 Project: Yetus Issue Type: Bug Components: Audience Annotations Environment: Gradle 4.6, Java 1.8.0_121 Reporter: Grant Henke The=C2=A0IncludePublicAnnotationsStandardDoclet does not work with Gradle J= avadoc generation, though it does for Maven in the same project. It appears= Maven passes slightly different arguments to the Javadoc tool.=C2=A0 In Gradle I configured the Javadoc task to use the Doclet via: {code:java} configurations { doclet } dependencies { doclet "org.apache.yetus:audience-annotations:0.7.0" } javadoc { options.docletpath =3D configurations.doclet.files.asType(List) options.doclet =3D 'org.apache.yetus.audience.tools.IncludePublicAnnotat= ionsStandardDoclet' }{code} Running _gradle javadoc_ results in:=C2=A0 =C2=A0 {code:java} IncludePublicAnnotationsStandardDoclet java.lang.ArrayStoreException: com.s= un.proxy.$Proxy2 at java.util.AbstractCollection.toArray(AbstractCollection= .java:196) at com.sun.tools.doclets.internal.toolkit.util.IndexBuilder.buil= dIndexMap(IndexBuilder.java:160) at com.sun.tools.doclets.internal.toolkit.= util.IndexBuilder.(IndexBuilder.java:124) at com.sun.tools.doclets.in= ternal.toolkit.util.IndexBuilder.(IndexBuilder.java:103) at com.sun.t= ools.doclets.formats.html.HtmlDoclet.generateOtherFiles(HtmlDoclet.java:122= ) at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.startGeneration(= AbstractDoclet.java:146) at com.sun.tools.doclets.internal.toolkit.Abstract= Doclet.start(AbstractDoclet.java:82) at com.sun.tools.doclets.formats.html.= HtmlDoclet.start(HtmlDoclet.java:80) at com.sun.tools.doclets.standard.Stan= dard.start(Standard.java:39) at org.apache.yetus.audience.tools.IncludePubl= icAnnotationsStandardDoclet.start(IncludePublicAnnotationsStandardDoclet.ja= va:51) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at su= n.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)= at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso= rImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.s= un.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:310) at com.sun.to= ols.javadoc.DocletInvoker.start(DocletInvoker.java:189) at com.sun.tools.ja= vadoc.Start.parseAndExecute(Start.java:366) at com.sun.tools.javadoc.Start.= begin(Start.java:219) at com.sun.tools.javadoc.Start.begin(Start.java:205) = at com.sun.tools.javadoc.Main.execute(Main.java:64) at com.sun.tools.javado= c.Main.main(Main.java:54) {code} =C2=A0 Digging into the stack trace a bit it appears that the issue comes from bui= lding an index of packages, however Gradle passes the class files to Javado= c and does not pass packages. This is a valid way to generate Javadoc as do= cumented here: [https://docs.oracle.com/javase/7/docs/technotes/tools/solar= is/javadoc.html#documentingclasses] The Javadoc options Gradle generates are (with path substitutions):=C2=A0 =C2=A0 {code:java} -classpath '/some/classpath/paths/...' -d '/some/destination/directory' -doclet 'org.apache.yetus.audience.tools.IncludePublicAnnotationsStandardDo= clet' -docletpath '/path/to/audience-annotations-0.7.0.jar' -doctitle 'some API' -quiet=20 -windowtitle 'some API' '/path/to/some/Class.java' '/path/to/some/Class2.java' '/path/to/some/Class3.java' ...{code} There is no great way to add packages to the Javadoc options output in Grad= le, but one hacky solution does allow it to successfully generate Javadocs.= Forcing a valid package name into the options by passing it with an option= that takes no arguments will allow the task to succeed.=C2=A0 In Gradle I added: =C2=A0 {code:java} javadoc { ... // A Javadoc option that takes no parameter,=20 // and a valid package as the parameter. options.addStringOption("notimestamp", "some.valid.package") }{code} This results in the the following javadoc options: =C2=A0 =C2=A0 {code:java} -classpath '/some/classpath/paths/...' -d '/some/destination/directory' -doclet 'org.apache.yetus.audience.tools.IncludePublicAnnotationsStandardDo= clet' -docletpath '/path/to/audience-annotations-0.7.0.jar' -doctitle 'some API' -notimestamp 'some.valid.package' -quiet=20 -windowtitle 'some API' '/path/to/some/Class.java' '/path/to/some/Class2.java' '/path/to/some/Class3.java' ... {code} Note: The packages would generally come just before the list of classes per= the documentation, but this seams to work for some reason. (https://docs.o= racle.com/javase/7/docs/technotes/tools/solaris/javadoc.html#documentingbot= h) =C2=A0 When running gradle javadoc there may be a warning like below when using th= is hacky workaround: {code:java} javadoc: warning - No source files for package some.valid.package {code} =C2=A0 =C2=A0 =C2=A0 -- This message was sent by Atlassian JIRA (v7.6.3#76005)