I'm trying to prepare and upload my Android library to Bintray and part of that process runs the following javadoc task:
我正在准备并上传我的Android库到Bintray,这个过程的一部分运行如下的javadoc任务:
task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
This task is part of a larger gradle script here: https://raw.githubusercontent.com/attwellBrian/JCenter/master/bintrayv1.gradle
这个任务是一个较大的gradle脚本的一部分:https://raw.githubusercontent.com/attwellBrian/JCenter/master/bintrayv1.gradle。
When the javadoc
task runs, the following problems occur:
当运行javadoc任务时,会出现以下问题:
- Every @NonNull and @Nullable annotation in the project reports an error of "error: cannot find symbol"
- 项目中的每个@NonNull和@Nullable注释都报告一个“error: couldn ' t find symbol”的错误
- Every Javadoc reference I've written for an Android class, like {@link Toolbar}, reports an error of "error: reference not found"
- 我为Android类编写的每个Javadoc引用,比如{@link工具栏},都报告了“错误:引用未找到”的错误
How can I correct these reference issues when generating Javadocs?
如何在生成Javadocs时纠正这些引用问题?
EDIT It looks like its not all Android class links that are creating an issue, it may just be classes that come from the Android support library (which is also where the annotations come from). Does something special need to be done to link to source files in gradle dependencies?
编辑它看起来不是所有的Android类链接都有问题,它可能只是来自Android支持库的类(注释也来自于这个库)。需要做一些特殊的事情来链接到等级依赖的源文件吗?
2 个解决方案
#1
19
You should also add all your dependency to the javadoc.classpath. Try this:
您还应该将所有依赖项添加到javadoc.classpath。试试这个:
task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
afterEvaluate {
javadoc.classpath += files(android.libraryVariants.collect { variant ->
variant.javaCompile.classpath.files
})
}
#2
0
So these error mean that JavaDoc can't link the classes which are not in the same module (without further config). If you don't care about this (ie. having hyperlinks to classes outside of the module) you could just ignore the errors with
因此,这些错误意味着JavaDoc不能链接不在同一模块中的类(没有进一步的配置)。如果你不关心这个的话。有到模块之外的类的超链接)您可以忽略错误
task javadoc(type: Javadoc) {
failOnError false
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
See here for more info on the Javadoc Task
有关Javadoc任务的更多信息,请参见这里
#1
19
You should also add all your dependency to the javadoc.classpath. Try this:
您还应该将所有依赖项添加到javadoc.classpath。试试这个:
task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
afterEvaluate {
javadoc.classpath += files(android.libraryVariants.collect { variant ->
variant.javaCompile.classpath.files
})
}
#2
0
So these error mean that JavaDoc can't link the classes which are not in the same module (without further config). If you don't care about this (ie. having hyperlinks to classes outside of the module) you could just ignore the errors with
因此,这些错误意味着JavaDoc不能链接不在同一模块中的类(没有进一步的配置)。如果你不关心这个的话。有到模块之外的类的超链接)您可以忽略错误
task javadoc(type: Javadoc) {
failOnError false
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
See here for more info on the Javadoc Task
有关Javadoc任务的更多信息,请参见这里