I am new to asciidoc. I want to create HTML documentation from a javadoc comment (in asciidoc format) in a java file.
e.g. java file
public class Asciidoclet extends Doclet {
}
I can generate an html file from an .ad file, but I do not know how to generate an .ad file (or any asciidoc file) from javadoc.
So I want to generate a .ad (asciidoc) file, which I use to generate html documentation using asciidoctor-maven-plugin. asciidoctor-maven-plugin will check the .ad files in the source directory and generate the html file in outputDirectory.
</plugin>
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<version>${asciidoctor.version}</version>
<executions>
<execution>
<id>output-html</id>
<phase>generate-resources</phase>
<goals>
<goal>process-asciidoc</goal>
</goals>
</execution>
</executions>
<configuration>
<sourceDirectory>asciidocs</sourceDirectory>
<outputDirectory>asciidocs-output</outputDirectory>
<backend>html</backend>
<doctype>book</doctype>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
<configuration>
<source>1.7</source>
<doclet>org.asciidoctor.Asciidoclet</doclet>
<docletArtifact>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoclet</artifactId>
<version>${asciidoclet.version}</version>
</docletArtifact>
<overview>src/main/java/overview.adoc</overview>
<additionalparam>
--base-dir ${project.basedir}
--attribute "name=${project.name}"
--attribute "version=${project.version}"
--attribute "title-link=http://example.com[${project.name} ${project.version}]"
</additionalparam>
</configuration>
</plugin>
Dependence
<asciidoclet.version>1.5.0</asciidoclet.version>
<asciidoctor.version>1.5.0</asciidoctor.version>
<dependency>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj</artifactId>
<version>1.5.2</version>
</dependency>
asciidoclet, . html, pdf, epub ..
...
maven-javadoc-plugin mvn org.apache.maven.plugins:maven-javadoc-plugin:2.9:jar, html-java- .adoc.
- , ?
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
<executions>
<execution>
<id>javadoc-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<includeDependencySources>true</includeDependencySources>
<dependencySourceExcludes>
<dependencySourceExclude>commons-cli:*</dependencySourceExclude>
</dependencySourceExcludes>
<source>1.7</source>
<doclet>org.asciidoctor.Asciidoclet</doclet>
<docletArtifact>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoclet</artifactId>
<version>${asciidoclet.version}</version>
</docletArtifact>
<overview>src/main/java/overview.adoc</overview>
<additionalparam>
--base-dir ${project.basedir}
--attribute "name=${project.name}"
--attribute "version=${project.version}"
--attribute "title-link=http://example.com[${project.name} ${project.version}]"
</additionalparam>
</configuration>
</execution>
</executions>
</plugin>
.