使用 Asciidoctor Maven 插件以 HTML 格式发布 API 文档时未解决的指令错误



我成功地使用Spring RestDocs编写测试并生成片段。

当我使用 Asciidoctor Maven plugin 以 HTML 格式发布 API 文档时,会生成 HTML 文档。

但是,HTML 显示以下错误。似乎我的包含没有按预期运行。我想知道可能出了什么问题。

api-guide.adoc 中未解析的指令 - include:/opt/caweb/thoughtworks/go-agent/pipelines/xxx_Build/xxx-source/target/generated-snippets/createating-grouping/curl-request.adoc[]

以下是POM的asciidoctor-maven-plugin和maven-resources-plugin部分.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>

这是我的api-guide.adoc的包含部分:

include::{snippets}/create-grouping/curl-request.adoc[]

感谢您的帮助!

您是否正在配置确定的插件以包含您的文档文件?

https://github.com/spring-projects/spring-restdocs/blob/master/docs/src/docs/asciidoc/getting-started.adoc

在这里查看

我通过将 asciidoctor 的阶段从准备包更改为来解决它

相关内容

最新更新