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.00
# Groovy-GroovyDoc
1
2
Groovy-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.
3
4
## Package Information
5
6
- **Package Name**: groovy-groovydoc
7
- **Package Type**: maven
8
- **Group ID**: org.apache.groovy
9
- **Language**: Java
10
- **Installation**: Add dependency to build.gradle:
11
12
```gradle
13
dependencies {
14
implementation 'org.apache.groovy:groovy-groovydoc:5.0.0'
15
}
16
```
17
18
Or Maven:
19
20
```xml
21
<dependency>
22
<groupId>org.apache.groovy</groupId>
23
<artifactId>groovy-groovydoc</artifactId>
24
<version>5.0.0</version>
25
</dependency>
26
```
27
28
## Core Imports
29
30
```java
31
import org.codehaus.groovy.tools.groovydoc.GroovyDocTool;
32
import org.codehaus.groovy.groovydoc.GroovyRootDoc;
33
import org.codehaus.groovy.tools.groovydoc.FileOutputTool;
34
import org.codehaus.groovy.tools.groovydoc.FileSystemResourceManager;
35
```
36
37
## Basic Usage
38
39
```java
40
import org.codehaus.groovy.tools.groovydoc.GroovyDocTool;
41
import org.codehaus.groovy.groovydoc.GroovyRootDoc;
42
import org.codehaus.groovy.tools.groovydoc.FileOutputTool;
43
44
// Basic documentation generation
45
String[] sourcePaths = {"/path/to/groovy/source"};
46
GroovyDocTool tool = new GroovyDocTool(sourcePaths);
47
48
// Add source files to process
49
List<String> sourceFiles = Arrays.asList(
50
"com/example/MyClass.groovy",
51
"com/example/MyInterface.groovy"
52
);
53
tool.add(sourceFiles);
54
55
// Generate documentation to output directory
56
FileOutputTool output = new FileOutputTool();
57
tool.renderToOutput(output, "/path/to/output/docs");
58
```
59
60
## Architecture
61
62
The Groovy-GroovyDoc system is built around several key components:
63
64
- **Documentation Tool** - The main API for generating documentation from source code
65
- **Documentation Model** - A hierarchical object model representing the parsed documentation structure
66
- **Output Management** - Flexible system for writing generated documentation to various targets
67
- **Template Engine** - Groovy-based template processing for customizable documentation output
68
- **Resource Management** - System for loading templates and resources from filesystem or classpath
69
70
## Capabilities
71
72
### Documentation Generation
73
74
The core functionality for generating documentation from Groovy source code, including parsing source files, extracting comments, and creating the documentation model.
75
76
```java
77
// Basic tool creation and usage
78
GroovyDocTool tool = new GroovyDocTool(sourcePaths);
79
tool.add(sourceFiles);
80
GroovyRootDoc rootDoc = tool.getRootDoc();
81
```
82
83
Key API components:
84
- `GroovyDocTool` - Main entry point for documentation generation
85
- `GroovyRootDoc getRootDoc()` - Access to the complete documentation model
86
87
[Documentation Generation](./doc-generation.md)
88
89
### Documentation Model
90
91
A comprehensive object model that represents the structure of documented code, including packages, classes, methods, fields, and their relationships.
92
93
```java
94
// Access documentation model
95
GroovyRootDoc rootDoc = tool.getRootDoc();
96
GroovyClassDoc[] classes = rootDoc.classes();
97
GroovyPackageDoc[] packages = rootDoc.specifiedPackages();
98
```
99
100
Key API components:
101
- `GroovyRootDoc` - Root of the documentation tree
102
- `GroovyClassDoc` - Class and interface documentation
103
- `GroovyMethodDoc`, `GroovyFieldDoc` - Member documentation
104
- `GroovyPackageDoc` - Package-level documentation
105
106
[Documentation Model](./doc-model.md)
107
108
### Output Management
109
110
Flexible system for writing generated documentation to various output targets, including file system, in-memory storage, and custom implementations.
111
112
```java
113
// File system output
114
FileOutputTool fileOutput = new FileOutputTool();
115
tool.renderToOutput(fileOutput, "/output/directory");
116
117
// In-memory output for testing
118
MockOutputTool mockOutput = new MockOutputTool();
119
tool.renderToOutput(mockOutput, "test-docs");
120
```
121
122
Key API components:
123
- `OutputTool` - Abstract interface for output targets
124
- `FileOutputTool` - File system output implementation
125
- `MockOutputTool` - In-memory output for testing
126
127
[Output Management](./output-management.md)
128
129
### Template Engine
130
131
Groovy-based template processing system that allows customization of generated documentation appearance and structure.
132
133
```java
134
// Template engine with custom templates
135
String[] classTemplates = {"custom-class-template.html"};
136
ResourceManager resourceManager = new FileSystemResourceManager("/templates");
137
GroovyDocTemplateEngine engine = new GroovyDocTemplateEngine(
138
tool, resourceManager, classTemplates
139
);
140
```
141
142
Key API components:
143
- `GroovyDocTemplateEngine` - Template processing engine
144
- `ResourceManager` - Template and resource loading
145
- `GroovyDocTemplateInfo` - Default template configurations
146
147
[Template Engine](./template-engine.md)