Generate a static API reference for a Java library through Javadoc, Gradle, or Maven. Every build extracts the library’s public API into api.json and renders HTML and Markdown from that model. Open index.html directly or publish the output directory. Pages, styles, search, and navigation work offline.
Run Javadoc with JDK 25. The build also needs Node.js or Bun on PATH to execute the renderer bundled in the JAR. Readers only need a browser. The documentation JDK can be newer than the library’s Java target.
javadoc -doclet dev.elide.doclet.ElideDoclet -docletpath tools/elide-doclet.jar \
-d build/docs --module-name catalogue --module-version 1.0 \
-sourcepath src/main/java -subpackages com.exampleThe name and version are optional. A named Java module supplies the default title. Gradle and Maven supply the project’s name and version.
Besides the HTML pages, a site has a Markdown twin of every page, llms.txt and llms-full.txt for AI agents, and api.json, the model. Leave any of them out with --no-markdown, --no-llms, or --no-model; the pages then link only to the files the site has. In Gradle, add them to the Javadoc task with options.addBooleanOption("-no-markdown", true).
Every page holds only its own path through the navigation tree: its package, that package’s types, and the current type’s nested types. The whole tree is loaded once from assets/nav.js, which works from file:// too, so a page’s size follows its own content rather than the size of the library.
For a standalone model export, use --model-only. It writes api.json into the output directory and skips the JavaScript runtime. Use an empty directory for a model-only build.
For a released version, add the public Elide Maven repository to the top-level pluginManagement block in settings.gradle.kts.
pluginManagement {
repositories {
maven {
url = uri("https://maven.elide.dev")
}
gradlePluginPortal()
}
}Apply the plugin in build.gradle.kts and run ./gradlew javadoc. The plugin configures existing and future Javadoc tasks, including their doclet path.
plugins {
java
id("dev.elide.doclet") version "0.3.0" // x-release-please-version
}Add the repository and plugin to the consuming POM, then run mvn elide-doclet:javadoc. To generate docs during mvn package, add an execution for the javadoc goal. Its default phase is prepare-package.
<pluginRepositories>
<pluginRepository>
<id>elide-doclet</id>
<url>https://maven.elide.dev</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>dev.elide</groupId>
<artifactId>elide-doclet-maven-plugin</artifactId>
<version>0.3.0</version><!-- x-release-please-version -->
</plugin>
</plugins>
</build>Pass a directory of Markdown files to publish narrative pages with the API. For example, docs/guides/lookup.md generates guides/lookup.html and its Markdown twin.
# Look up a book
Use [the catalog](api/example.Example) to [find a title](api/example.Example#find(java.lang.String)).Start each file with a level-one title. The first paragraph supplies the summary for listings and search. Use lowercase letters, digits, and hyphens for file and directory names. An optional root index.md supplies the module overview. An api/ link uses the exact type or member ID from api.json, including $ for nested types. The linked type lists the guide under See also. A missing API target fails the build and names the guide to fix.
| Entry point | Guide directory | Signature formatter |
|---|---|---|
| Javadoc | --guides docs/guides |
--signature-formatter <executable-or-none> |
| Gradle properties | elideDoclet.guides=docs/guides |
elideDoclet.signatureFormatter=none |
| Maven plugin configuration | <guides>docs/guides</guides> |
<signatureFormatter>none</signatureFormatter> |
By default the generator looks for elide on PATH and uses it to wrap long declarations while preserving type links. If Elide is unavailable, or you select none, declarations keep their single-line layout. Formatting and guide references are part of the shared API model, so HTML and Markdown use the same declarations and links.
Add dev.elide:elide-doclet-dokka-plugin:<version> from the public Elide Maven repository to Dokka's plugins classpath alongside dokka-base and analysis-kotlin-symbols 2.3.0. Include its transitive core dependency. The plugin reads a JVM source set and renders the same reference from Kotlin declarations and KDoc. Set its JSON configuration under dev.elide.apidocs.dokka.ApiDocsPlugin. Options include theme, moduleVersion, signatureFormatter, and modelOnly. See the runnable Dokka consumer.
Build each module's standalone site with its model and search index. List the sites in a JSON manifest, newest version first. Module paths are relative to the manifest.
{
"title": "Library documentation",
"latest": "v2",
"versions": [
{"id": "v2", "modules": {"core": "build/v2/core", "sdk": "build/v2/sdk"},
"suites": {"handbook": {"title": "Developer handbook", "directory": "docs/handbook"}}},
{"id": "v1", "modules": {"core": "build/v1/core"}}
]
}java -cp elide-doclet.jar dev.elide.apidocs.render.Catalog build catalog.json build/reference
java -cp elide-doclet.jar dev.elide.apidocs.render.Catalog serve build/reference 8080Build into a new output directory, then publish its contents to any static host. The catalog offers version and module navigation, cross-module guide and API search, a latest/ copy of the selected release, and API changes against each older release. Version links preserve the current page when it exists. The optional loopback HTTP server serves standalone sites too. Request an HTML URL with Accept: text/markdown to receive its Markdown twin, or use the explicit .md URL on GitHub Pages.
A guide suite is a directory of Markdown files using the same title and first-paragraph summary format as module guides. In a suite, write links as [label](api/<module>/<declaration-id>). Kotlin types also accept their qualified name. The catalog validates links against that version’s Java and Kotlin models, adds backlinks on the declaration pages, and makes all suites and modules searchable from the reference search box. Keep drafts under a drafts/ directory. Set "includeDrafts": true on a preview version to include them. Shared Java and Kotlin sample
CI builds the shared catalog from real Javadoc and Dokka output. Mobile Lighthouse checks the guide and both linked API pages for performance (90), accessibility (100), best practices (95), SEO (95), and layout shift (at most 0.05). Stylelint checks authored gallery, theme and catalog CSS against selected Good CSS practices for logical properties, focus outlines and transitions.
AFDocs scans a specific Java type, Kotlin type, and cross-module guide before release. Each must pass index validity, Markdown availability, HTML/Markdown content parity, and HTTP negotiation checks. The build also resolves relative index links and checks guide backlinks, member anchors, JSON-LD, and the API model. After deployment, Pages repeats the content checks and reports how the host handles Markdown negotiation. GitHub Pages serves HTML for that header, so clients can follow the explicit Markdown link. CI saves candidate reports in the quality-reports artifact.
With the shared sample built (scripts/build-samples followed by scripts/build-shared-sample) and JDK 25 on PATH, run python3 scripts/eval-docs.py. CI runs the same experiment without credentials, model calls, or inference fees.
The harness builds standard Javadoc from the same Java sources. It pairs each of ten API questions with three discovery indexes (standard Javadoc, generated llms.txt, and type names alone) and two reading formats (Javadoc main text and generated Markdown). Each variant uses the same lexical retriever, one page fetch, and a 4,000-character reading budget. It records top-page accuracy, whether the expected evidence fits, and context characters per question in .dev/quality/doc-evals.json. Change --chars to test tighter budgets. The scope is type lookup on the Java sample; guides and Kotlin are covered by the separate quality gates.
For an answer-level experiment, pass --reader './your-model-wrapper' and --reader-label 'model/version and settings'. The wrapper reads a prompt on stdin and prints a short answer on stdout. For a local Ollama instance with a model already installed, use OLLAMA_MODEL=<installed-tag> python3 scripts/eval-docs.py --reader "python3 scripts/eval-ollama.py" --reader-label "<model tag/digest>, temperature 0, seed 42". A run makes 60 short calls. The report records answers and checks expected answer patterns against retrieved evidence. Use a fixed model and settings and inspect the paired answers before drawing conclusions. The default offline run measures retrieval, not model answer quality.
The default theme uses the library name. Supply a JSON theme to change the header, light and dark colors, logos, navigation, footer, and source links. For example, save this as docs/theme.json:
{
"productName": "Field Guide SDK",
"brand": "Field Guide",
"tokens": {
"light": { "accent": "#345b84" },
"dark": { "accent": "#99c4ed" }
},
"footer": "Field Guide developer documentation"
}| Entry point | Theme configuration |
|---|---|
| Javadoc | Add --theme docs/theme.json to the command |
| Gradle | Set elideDoclet.theme=docs/theme.json in gradle.properties |
| Maven | Add <configuration><theme>${project.basedir}/docs/theme.json</theme></configuration> to the plugin |
For a logo, set logo.light and logo.dark to SVG markup and logo.alt to its accessible name. Set baseUrl to generate canonical URLs and a sitemap. The renderer accepts the complete theme definition.
The doclet accepts the standard doclet's common options, so an existing Javadoc configuration keeps working:
-link <url>and-linkoffline <url> <dir-or-url>read another Javadoc site'selement-list(orpackage-list). Types, members and packages from that site link to its pages in signatures and in{@link}. Modular sites get a directory per module. For example,-linkoffline https://docs.oracle.com/en/java/javase/25/docs/api/ <dir with the JDK's element-list>links JDK types. If a list cannot be read, javadoc prints a warning and the run continues.-tag <name>:<locations>:<header>defines a custom block tag. Its content follows the description under the header. A tag whose locations includeXis left out.-windowtitle,-doctitle,-notimestampand-quietwork as before.- Javadoc accepts these options and prints a warning that they have no effect:
-header,-bottom,-footer,-top,-use,-author,-version,-splitindex,-nonavbar,-nodeprecated,-nodeprecatedlist,-nohelp,-noindex,-nosince,-notree,-linksource,-stylesheetfile,-overview,-group,-charset,-docencodingand similar presentation options. To change branding and the footer, use a theme.
By default, any comment the API model cannot represent stops the run with an error, so the reference never silently loses content. Examples are an unknown inline tag, a reference that does not resolve, or {@inheritDoc} with nothing to inherit. Each error ends with its category, such as [reference].
To publish while you fix comments, report problems as warnings instead. The affected parts are simplified or left out. --problems takes error or warning and accepts per-category overrides. Later entries win.
--problems warning # every problem is a warning
--problems error,inline-tag=warning # only unknown inline tags are warnings
--problems warning,reference=error # everything but unresolved references is a warningCategories: inheritdoc, block-tag, inline-tag, snippet, reference, html, url, value, param, malformed, unsupported.
| Entry point | Problem severity |
|---|---|
| Javadoc | Add --problems warning to the command |
| Gradle | Set elideDoclet.problems=warning in gradle.properties |
| Maven | Add <configuration><problems>warning</problems></configuration> to the plugin, or pass -DelideDoclet.problems=warning |
mise trust
mise install
mise exec -- hk install
elide build
(cd doclet && elide test --coverage --reporter=junit)
scripts/smoke-test
scripts/build-samples && scripts/check-size .dev/pages/signal
elide publish --dry-run
scripts/smoke-test-pluginsThe standalone test loads the published JAR through Javadoc. scripts/check-size holds every sample theme’s site to a size budget: each page’s navigator, shell, and inline SVG, the HTML per page, and the site’s text files. The plugin tests build one example API with each tool, verify its model, HTML, Markdown, and search assets, then render it again with a custom theme. Run one consumer with scripts/smoke-test-plugins gradle or scripts/smoke-test-plugins maven.
The shared model and DocumentationSite.write have no Javadoc dependencies. Another frontend can produce an Api.Model and use the same renderer. The renderer distribution is checked in so building the doclet or using it offline requires no frontend dependency installation. To refresh it from a components checkout, run scripts/update-renderer /path/to/components.
To try the plugins before a release, run elide publish from the workspace root. Maven uses the local repository automatically. In Gradle, add mavenLocal() to pluginManagement.repositories. The standalone core remains available as dev.elide:elide-doclet:<version> for direct use with javadoc -doclet dev.elide.doclet.ElideDoclet -docletpath <jar>.
Release Please updates the workspace members together from Conventional Commits on main. On release, CI publishes the tested JARs and POMs with checksums to the public Elide Maven repository on R2 and attaches them to the GitHub release.
Browse the sample gallery or edit the sample themes. Run scripts/build-samples and open .dev/pages/index.html to compare the module overview, package, guides, and Java declarations across all seven themes. The gallery links to each rendered reference and its complete JSON configuration. The GraalVM sample uses artwork from the official brand resources. The Micronaut and Google samples embed the Micronaut wordmark and Google wordmark.
For an interactive preview, serve the generated folder with python3 -m http.server 8787 --bind 127.0.0.1 --directory .dev/pages and open http://127.0.0.1:8787/preview.html. Rerun scripts/build-samples after editing a theme and reload the preview.