In an Android library project I use Gradle script to generate Javadocs:
task androidJavadocs(type: Exec, dependsOn: buildJavadocsClasspath) {
doFirst {
executable = 'javadoc'
args = [
'-classpath', javadocsClasspath,
'-sourcepath', './src/main/java',
'-subpackages', 'com.example.myproject',
'-d', javadocsDestinationDir,
'-exclude', 'com.example.myproject.internal',
'-doctitle', project.getName() + " " + VERSION_NAME + " API",
'-windowtitle', POM_NAME + " API",
'-link', "http://docs.oracle.com/javase/8/docs/api/",
'-Xdoclint:none',
'-quiet'
]
}
}
The problem is that Javadoc returns warnings (Java 8) or errors (Java 11) when generating javadocs for classes that reference autogenerated classes like BuildConfig or DaggerMyClientComponent
./src/main/java/com/example/myproject/MyClient.java:13: error: cannot find symbol
import com.example.myproject.internal.DaggerMyClientComponent;
^
symbol: class DaggerMyClientComponent
location: package com.example.myproject.internal
./src/main/java/com/example/myproject/internal/storage/client/SdkVersionStorage.java:9: error: cannot find symbol
import com.example.myproject.BuildConfig;
^
symbol: class BuildConfig
location: package com.example.myproject
./src/main/java/com/example/myproject/internal/utils/UserAgentHeader.java:8: error: cannot find symbol
import com.example.myproject.BuildConfig;
^
symbol: class BuildConfig
location: package com.example.myproject
One thing that I don't understand is that two errors come from internal classes that are already excluded from javadoc with the "exclude" argument.
On top of that, I don't see an option to fix or suppress those errors. Adding an exclude rule like com.example.myproject.internal.DaggerMyClientComponent
doesn't work.
Using Android Studio to generate Javadocs is not an option, I need to use a script that can be used in CI (Bitrise).
question from:
https://stackoverflow.com/questions/65842537/how-to-skip-autogenerated-classes-from-javadoc-using-gradle 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…