How to exclude Javadoc classpaths?

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:

  1. Exclude almost every dependencies from being documented.
    I think it should be like exclude("org.*") so I can exclude many dependencies at one, rather than declaring each dependencies, which would result massive long list.
  2. 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"
}

It’s unlucky to link to a paste service that only provides the paste a limited time.
Your paste is not there anymore.
Either use a different paste service, or probably better add it as file attachment here if the text is too long.

But anyway, that is more a question for that plugin you are using.
It’s documentation says it just aggregates the JavaDoc of your code not of any dependencies.
But I never used that plugin, so you should maybe ask in their support channel for help if it does not work like expected.