//It seems the gradle javadoc task works file by file and as such disable some features of javadoc tool //such as link to packages, https://groups.google.com/d/msg/gradle-dev/R83dy_6PHMc/bgw0cUTMFAAJ javadoc { description "Creates javadoc html for Mockito API." // For more details on the format // see https://docs.oracle.com/javase/8/docs/technotes/tools/windows/javadoc.html source = sourceSets.main.allJava destinationDir = file("$buildDir/javadoc") title = "Mockito ${project.version} API" // The way *gradle* javadoc task works and due to *gradle exclusion* the log output triggers javadoc warning and // errors on internal classes that are not found, non-exhaustive list : // // * import org.mockito.internal.Internal <- error: package org.mockito.internal does not exists // * import org.mockito.internal.Internal.util <- error: static import only from classes and interfaces // * class Public extends Internal <- cannot find symbol // * warning - Tag @linkplain: reference not found: org.mockito.internal.Internal internal stuff // * warning - Tag @link: reference not found: org.mockito.stubbing // // While there's errors the javadoc is still generated without those symbols or links ; // for this reason the javadoc output is suppressed and can be reactivated with --info option. exclude 'org/mockito/internal' logging.captureStandardError LogLevel.INFO logging.captureStandardOutput LogLevel.INFO // suppress "## warnings" message options.docTitle = """

Click to see examples. Mockito ${project.version} API.

""" options.windowTitle = "Mockito ${project.version} API" options.group("Main package", ["org.mockito"]) options.memberLevel = JavadocMemberLevel.PROTECTED options.outputLevel = JavadocOutputLevel.QUIET options.charSet = 'UTF-8' options.encoding = 'UTF-8' options.docEncoding = 'UTF-8' options.use = true options.splitIndex = true options.noDeprecated = false options.noDeprecatedList = false options.noIndex = false options.noNavBar = false options.noTree = false options.links = ['https://docs.oracle.com/javase/6/docs/api/', 'http://junit.org/junit4/javadoc/4.12/', 'http://hamcrest.org/JavaHamcrest/javadoc/1.3/'] options.header("""Mockito ${project.version} API""") options.footer("""Mockito ${project.version} API""") options.bottom(""" """.replaceAll(/\r|\n|[ ]{8}/, "")) options.stylesheetFile rootProject.file("src/javadoc/stylesheet.css") options.addStringOption('Xdoclint:none', '-quiet') def minorVersion = System.getProperty("java.version") =~ /1.8.0_(\d*)/ // Since JDK 8 version 121 scripts are not allowed in comments. However, // earlier version throw an error if an unknown option is passed. // Therefore only add this option if the JDK is actually correct. if (minorVersion.size() > 0 && Integer.valueOf(minorVersion[0][1]) >= 121 || JavaVersion.current().isJava9Compatible()) { options.addBooleanOption('-allow-script-in-comments', true) } doLast { copy { from "src/javadoc" into "$buildDir/javadoc" } } }