Skip to content

indra crossdoc

zml edited this page Sep 11, 2022 · 2 revisions

net.kyori.indra.crossdoc (added in indra v2.1.0) will automatically link between javadoc publications of modules within a multi-module project. URL patterns are configurable, and a helper task for publishing javadoc is provided.

Example

To generate javadoc, a baseUrl property must be set on the crossdoc extension:

indraCrossdoc {
  baseUrl().set(providers.gradleProperty("javadocPublishRoot")) // or a hardcoded URL
}

Other attributes can be specified too, like customizing the logic for how project URLs are constructed, relative to the base URL.

For example, if subprojects have a name prefix of foobar-, this could be stripped from the generated URLs with the following snippet:

indraCrossdoc {
  nameBasedDocumentationUrlProvider {
    projectNamePrefix = 'foobar-'
  }
}

DSL Reference

indraCrossdoc {
  baseUrl() // base URL for link generation
  projectDocumentationUrlProvider() // set a custom ProjectDocumentationUrlProvider
  nameBasedDocumentationUrlProvider { // or set + configure projectDocUrlProvider to a standard implementation
    projectNamePrefix = "some-prefix-" // (optional) prefix to strip
    version = "latest" // (optional) defaulting to current project version, can be cleared or overridden
  }
}

Tasks

The crossdoc plugin will add a few tasks. Generally, only copyJavadoc is useful for direct invocation.

generateOfflineLinks

A helper task, that will populate arguments to be passed to the javadoc task. This task is automatically wired up to produce an input of the Javadoc task.

copyJavadoc

Copy the unpacked output of the javadoc task to another directory, following the relative path computed by the provider set in the project extension.

The output directory can be provided as a command line argument, with the --output flag. By default, this output path is interpreted relative to the root project's project directory.