A documentation generation tool for Groovy code, part of the Apache Groovy programming language suite
npx @tessl/cli install tessl/maven-org-apache-groovy--groovy-groovydoc@5.0.0Groovy-GroovyDoc is a comprehensive documentation generation tool specifically designed for Groovy code, part of the Apache Groovy programming language suite. Similar to JavaDoc but tailored for Groovy's dynamic language features, it parses Groovy source files, extracts documentation comments and code structure, and generates HTML documentation with support for both Java and Groovy syntax.
dependencies {
implementation 'org.apache.groovy:groovy-groovydoc:5.0.0'
}Or Maven:
<dependency>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy-groovydoc</artifactId>
<version>5.0.0</version>
</dependency>import org.codehaus.groovy.tools.groovydoc.GroovyDocTool;
import org.codehaus.groovy.groovydoc.GroovyRootDoc;
import org.codehaus.groovy.tools.groovydoc.FileOutputTool;
import org.codehaus.groovy.tools.groovydoc.FileSystemResourceManager;import org.codehaus.groovy.tools.groovydoc.GroovyDocTool;
import org.codehaus.groovy.groovydoc.GroovyRootDoc;
import org.codehaus.groovy.tools.groovydoc.FileOutputTool;
// Basic documentation generation
String[] sourcePaths = {"/path/to/groovy/source"};
GroovyDocTool tool = new GroovyDocTool(sourcePaths);
// Add source files to process
List<String> sourceFiles = Arrays.asList(
"com/example/MyClass.groovy",
"com/example/MyInterface.groovy"
);
tool.add(sourceFiles);
// Generate documentation to output directory
FileOutputTool output = new FileOutputTool();
tool.renderToOutput(output, "/path/to/output/docs");The Groovy-GroovyDoc system is built around several key components:
The core functionality for generating documentation from Groovy source code, including parsing source files, extracting comments, and creating the documentation model.
// Basic tool creation and usage
GroovyDocTool tool = new GroovyDocTool(sourcePaths);
tool.add(sourceFiles);
GroovyRootDoc rootDoc = tool.getRootDoc();Key API components:
GroovyDocTool - Main entry point for documentation generationGroovyRootDoc getRootDoc() - Access to the complete documentation modelA comprehensive object model that represents the structure of documented code, including packages, classes, methods, fields, and their relationships.
// Access documentation model
GroovyRootDoc rootDoc = tool.getRootDoc();
GroovyClassDoc[] classes = rootDoc.classes();
GroovyPackageDoc[] packages = rootDoc.specifiedPackages();Key API components:
GroovyRootDoc - Root of the documentation treeGroovyClassDoc - Class and interface documentationGroovyMethodDoc, GroovyFieldDoc - Member documentationGroovyPackageDoc - Package-level documentationFlexible system for writing generated documentation to various output targets, including file system, in-memory storage, and custom implementations.
// File system output
FileOutputTool fileOutput = new FileOutputTool();
tool.renderToOutput(fileOutput, "/output/directory");
// In-memory output for testing
MockOutputTool mockOutput = new MockOutputTool();
tool.renderToOutput(mockOutput, "test-docs");Key API components:
OutputTool - Abstract interface for output targetsFileOutputTool - File system output implementationMockOutputTool - In-memory output for testingGroovy-based template processing system that allows customization of generated documentation appearance and structure.
// Template engine with custom templates
String[] classTemplates = {"custom-class-template.html"};
ResourceManager resourceManager = new FileSystemResourceManager("/templates");
GroovyDocTemplateEngine engine = new GroovyDocTemplateEngine(
tool, resourceManager, classTemplates
);Key API components:
GroovyDocTemplateEngine - Template processing engineResourceManager - Template and resource loadingGroovyDocTemplateInfo - Default template configurations