我在我的库build.gradle中添加了我的自定义gradle任务,其中Doclava实现为:
android.libraryVariants.all { variant ->
task("generateNew${variant.name.capitalize()}Javadoc", type: Javadoc) {
title = ""
destinationDir = new File("${project.getProjectDir()}/doc/compiled/", variant.baseName)
description "Generates Javadoc for $variant.name."
source = variant.javaCompile.source
ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar"
classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar) + project.files(android.getBootClasspath().join(File.pathSeparator))
options {
memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PRIVATE
links "http://docs.oracle.com/javase/8/docs/api/"
linksOffline "http://d.android.com/reference", "${android.sdkDirectory}/docs/reference"
doclet = "com.google.doclava.Doclava"
List<File> pathList = new ArrayList<File>();
pathList.add(file('./libs/doclava-1.0.6.jar'))
docletpath = pathList
}
exclude '**/BuildConfig.java'
exclude '**/R.java'
}
}
当我运行任务gradle时,给我错误 javadoc:error - invalid flag:-link 。但是当我删除链接时,可以运行任务。 linksOffline选项。另一个问题是提供的PRIVATE成员选项不起作用,生成的文档仅显示公共成员。
有没有办法解决它,以便使用Doclava doclet我可以获得Android和Java引用的引用链接?