I’m trying to publish javadoc with shadow jar (which acts as main jar).
Since javadoc comments are scattered across multiple subprojects, I tried to use ‘io.freefair.aggregate-javadoc-jar’ plugin.
The problem is, when I tried to run gradle build
, Gradle will try to run aggregateJavadocJar
task too, and it takes ages to run. This usally result build failure because build takes too long in JitPack CI server.
So I looked javadoc.options
generated in <root>/build/tmp/aggregateJavadoc
path. Here is the paste of the file. The file was too long so I put it on paste.
As you can see, it tries to document all dependencies which is not good. I only want to document things of my own, not other’s.
So I have to something either of:
- Exclude almost every dependencies from being documented.
I think it should be likeexclude("org.*")
so I can exclude many dependencies at one, rather than declaring each dependencies, which would result massive long list. - Declare what should be documented.
For instance, I tell Gradle to document classes of my own project only, not others.
But even after google search, I couldn’t find any good way to define such things.
Here is my current build.gradle.kts
.
import org.gradle.api.attributes.Bundling.BUNDLING_ATTRIBUTE
import org.gradle.api.attributes.Bundling.EXTERNAL
import org.gradle.api.attributes.Category.CATEGORY_ATTRIBUTE
import org.gradle.api.attributes.Category.VERIFICATION
import org.gradle.api.attributes.VerificationType.MAIN_SOURCES
import org.gradle.api.attributes.VerificationType.VERIFICATION_TYPE_ATTRIBUTE
import org.gradle.kotlin.dsl.named
plugins {
`java-library`
`maven-publish`
id("com.github.johnrengelman.shadow") version("7.1.2")
//id("io.freefair.aggregate-javadoc") version("6.5.1")
id("io.freefair.aggregate-javadoc-jar") version("6.5.1")
}
@Suppress("UnstableApiUsage")
val mainSources by configurations.creating<Configuration> {
isVisible = false
isCanBeResolved = true
isCanBeConsumed = false
attributes {
attribute(CATEGORY_ATTRIBUTE, objects.named(VERIFICATION))
attribute(BUNDLING_ATTRIBUTE, objects.named(EXTERNAL))
attribute(VERIFICATION_TYPE_ATTRIBUTE, objects.named(MAIN_SOURCES))
}
}
dependencies {
implementation(project(":bukkit_1_19_R1", "reobf")) {
isTransitive = false
}
implementation(project(":core"))
mainSources(project(":bukkit_1_19_R1"))
mainSources(project(":core"))
}
tasks {
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}
build {
dependsOn(shadowJar)
}
shadowJar {
archiveClassifier.set("")
}
}
allprojects {
group = "com.github.exmsrv"
version = "1.0.0-SNAPSHOT"
}