I have success use Spring RestDocs to write a test and generated snippets.
When I use the Asciidoctor Maven plugin
to publish the API documentation in HTML format, the HTML doc is generated.
However, the HTML shows following error. It seems that my include does not function as expected. I wonder what could be wrong.
Unresolved directive in api-guide.adoc - include::/opt/caweb/thoughtworks/go-agent/pipelines/xxx_Build/xxx-source/target/generated-snippets/creating-grouping/curl-request.adoc[]
Here is asciidoctor-maven-plugin and maven-resources-plugin sections of POM.xml:
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<version>1.5.2</version>
<executions>
<execution>
<id>generate-docs</id>
<phase>prepare-package</phase>
<goals>
<goal>process-asciidoc</goal>
</goals>
<configuration>
<backend>html</backend>
<doctype>book</doctype>
<attributes>
<snippets>${project.build.directory}/generated-snippets</snippets>
</attributes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.outputDirectory}/static/docs</outputDirectory>
<resources>
<resource>
<directory>${project.build.directory}/generated-docs</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
Here is the include section of my api-guide.adoc:
include::{snippets}/create-grouping/curl-request.adoc[]
Thanks for the help!