fixed output directory
This commit is contained in:
parent
149e4035d7
commit
386c67d959
49
README.md
Normal file
49
README.md
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
# Activiti API Doclet
|
||||||
|
|
||||||
|
This library provides a Javadoc Doclet for the generation of Activiti API documentation. You can use it by defining a Javadoc plugin in your Activiti extension Maven JAR project. That plugin should be configured to use this doclet. See the snippet below.
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<profile>
|
||||||
|
<id>apidocs</id>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
|
<version>3.4.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>generate-doclet</id>
|
||||||
|
<phase>generate-resources</phase>
|
||||||
|
<goals><goal>javadoc</goal></goals>
|
||||||
|
<configuration>
|
||||||
|
<doclet>com.inteligr8.activiti.doclet.ActivitiDoclet</doclet>
|
||||||
|
<docletArtifact>
|
||||||
|
<groupId>com.inteligr8.activiti</groupId>
|
||||||
|
<artifactId>activiti-api-doclet</artifactId>
|
||||||
|
<version>1.0.1</version>
|
||||||
|
</docletArtifact>
|
||||||
|
<useStandardDocletOptions>false</useStandardDocletOptions>
|
||||||
|
<destDir>apidocs</destDir>
|
||||||
|
<reportOutputDirectory>${basedir}</reportOutputDirectory>
|
||||||
|
<additionalOptions>
|
||||||
|
<additionalOption>--flavor bitbucket</additionalOption>
|
||||||
|
<additionalOption>--title 'API Documentation'</additionalOption>
|
||||||
|
<additionalOption>--apiName '${project.name}</additionalOption>
|
||||||
|
</additionalOptions>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
```
|
||||||
|
|
||||||
|
You can generate the docs with the following command:
|
||||||
|
|
||||||
|
```
|
||||||
|
mvn -Papidocs generate-resources
|
||||||
|
```
|
||||||
|
|
||||||
|
The documentation will be placed in `<reportOutputDirectory>/<destDir>`.
|
@ -50,10 +50,12 @@
|
|||||||
<version>@pom.version@</version>
|
<version>@pom.version@</version>
|
||||||
</docletArtifact>
|
</docletArtifact>
|
||||||
<useStandardDocletOptions>false</useStandardDocletOptions>
|
<useStandardDocletOptions>false</useStandardDocletOptions>
|
||||||
<destDir>destDir</destDir>
|
<destDir>apidocs</destDir>
|
||||||
|
<reportOutputDirectory>${basedir}</reportOutputDirectory>
|
||||||
<additionalOptions>
|
<additionalOptions>
|
||||||
<additionalOption>-d d</additionalOption>
|
|
||||||
<additionalOption>--flavor bitbucket</additionalOption>
|
<additionalOption>--flavor bitbucket</additionalOption>
|
||||||
|
<additionalOption>--title 'Example Title'</additionalOption>
|
||||||
|
<additionalOption>--apiName '${project.name}'</additionalOption>
|
||||||
</additionalOptions>
|
</additionalOptions>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
|
@ -44,7 +44,7 @@ import jdk.javadoc.doclet.Reporter;
|
|||||||
public class ActivitiDoclet implements Doclet {
|
public class ActivitiDoclet implements Doclet {
|
||||||
|
|
||||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||||
private String outputDirectory;
|
|
||||||
private String flavor;
|
private String flavor;
|
||||||
private String title;
|
private String title;
|
||||||
private String apiName;
|
private String apiName;
|
||||||
@ -57,13 +57,6 @@ public class ActivitiDoclet implements Doclet {
|
|||||||
@Override
|
@Override
|
||||||
public Set<? extends Option> getSupportedOptions() {
|
public Set<? extends Option> getSupportedOptions() {
|
||||||
return new HashSet<>(Arrays.asList(
|
return new HashSet<>(Arrays.asList(
|
||||||
new PathOption("-d", "Destination directory for output files", Kind.STANDARD, "--destDir") {
|
|
||||||
@Override
|
|
||||||
public boolean process(String name, List<String> valueAndClasses) {
|
|
||||||
outputDirectory = valueAndClasses.get(0);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
new ValueOption("--flavor", "Flavor of the markdown host: github or bitbucket", Kind.STANDARD) {
|
new ValueOption("--flavor", "Flavor of the markdown host: github or bitbucket", Kind.STANDARD) {
|
||||||
@Override
|
@Override
|
||||||
public boolean process(String name, List<String> valueAndClasses) {
|
public boolean process(String name, List<String> valueAndClasses) {
|
||||||
@ -122,7 +115,7 @@ public class ActivitiDoclet implements Doclet {
|
|||||||
List<ActivitiApiBeanDoc> beandocs = docfilter.build();
|
List<ActivitiApiBeanDoc> beandocs = docfilter.build();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
MarkdownWriter mdwriter = new MarkdownWriter(docenv, this.outputDirectory);
|
MarkdownWriter mdwriter = new MarkdownWriter(docenv);
|
||||||
if (this.title != null)
|
if (this.title != null)
|
||||||
mdwriter.setTitle(this.title);
|
mdwriter.setTitle(this.title);
|
||||||
if (this.apiName != null)
|
if (this.apiName != null)
|
||||||
@ -193,17 +186,4 @@ public class ActivitiDoclet implements Doclet {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private abstract class PathOption extends ValueOption {
|
|
||||||
|
|
||||||
public PathOption(String name, String description, Kind kind, String... additionalNames) {
|
|
||||||
super(name, description, kind, additionalNames);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getParameters() {
|
|
||||||
return "<dir>";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -61,15 +61,9 @@ class MarkdownWriter {
|
|||||||
private String apiName;
|
private String apiName;
|
||||||
private String flavor;
|
private String flavor;
|
||||||
|
|
||||||
public MarkdownWriter(DocletEnvironment docenv, String outputDirectory) throws IOException {
|
public MarkdownWriter(DocletEnvironment docenv) throws IOException {
|
||||||
this.docenv = docenv;
|
this.docenv = docenv;
|
||||||
this.outputDirectory = (outputDirectory == null || outputDirectory.trim().length() == 0) ? new File(".") : new File(outputDirectory);
|
this.outputDirectory = new File(".");
|
||||||
this.fmconfig = this.getFreemarkerConfiguration();
|
|
||||||
}
|
|
||||||
|
|
||||||
public MarkdownWriter(DocletEnvironment docenv, File outputDirectory) throws IOException {
|
|
||||||
this.docenv = docenv;
|
|
||||||
this.outputDirectory = outputDirectory == null ? new File(".") : outputDirectory;
|
|
||||||
this.fmconfig = this.getFreemarkerConfiguration();
|
this.fmconfig = this.getFreemarkerConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +105,6 @@ class MarkdownWriter {
|
|||||||
this.logger.debug("Building documentation index model");
|
this.logger.debug("Building documentation index model");
|
||||||
|
|
||||||
IndexFreemarkerModel indexModel = new IndexFreemarkerModel();
|
IndexFreemarkerModel indexModel = new IndexFreemarkerModel();
|
||||||
System.out.println("title: " + this.title);
|
|
||||||
indexModel.setTitle(this.title);
|
indexModel.setTitle(this.title);
|
||||||
indexModel.setApiName(this.apiName);
|
indexModel.setApiName(this.apiName);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user