Last active
September 5, 2020 04:31
-
-
Save SnapperGee/e63d302ec62b1f10648f0cc07a5a69c8 to your computer and use it in GitHub Desktop.
Gradle task that opens generated JavaDoc package overview HTML page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This Gradle task assumes 3 things: | |
* | |
* 1.) The "open" command of the shell this task is executed in opens HTML files with a web browser. | |
* 2.) The name of the generated JavaDoc overview HTML page created by the JavaDoc task is set to its default name of "index.html". | |
* 3.) That Java 11 is being used. If that's not the case, then the `options.links` argument should be updated to the correct Java version. | |
* | |
* It should also be noted that any link reference to a Java class that's part of the `java.lang` package will have the "java.lang" | |
* qualifier omitted. If this behavior is unwanted then delete or update the `options.noQualifiers` argument to refelct the desired | |
* behavior. | |
*/ | |
javadoc | |
{ | |
options.noQualifiers 'java.lang' | |
options.memberLevel = JavadocMemberLevel.PACKAGE | |
options.links 'https://docs.oracle.com/en/java/javase/11/docs/api' | |
options.linkSource true | |
} | |
tasks.register("view-javadoc", Exec) | |
{ | |
group = 'View' | |
description = 'Opens JavaDoc package overview HTML page in a web browser' | |
workingDir = javadoc.destinationDir | |
executable = 'open' | |
args += 'index.html' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment