配置警告中不存在此类代码段

No such snippet is present in configuration warning

我正在使用 Spring rest auto docs 和 AsciiDoc 做文档。下面是我的错误信息

错误信息

Section snippet 'auto-method-path' is configured to be included in the section but no such snippet is present in configuration

Section snippet 'auto-description' is configured to be included in the section but no such snippet is present in configuration

正在生成自动方法路径,因此我不知道警告来自何处。但是自动描述是根据文档,控制器的 javaDoc 所以我不知道为什么没有生成这个文档。

Java文档

/**
   * Returns a Customer
   *
   * @param id       the id of the customer
   * @return the customer
   */
  @GetMapping(path = "api/customer/{id}", produces = HAL_JSON_VALUE)

已修复。我在我的 Pom 上遗漏了这个:

   <execution>
            <id>generate-javadoc-json</id>
            <phase>compile</phase>
            <goals>
              <goal>javadoc-no-fork</goal>
            </goals>
            <configuration>
              <doclet>capital.scalable.restdocs.jsondoclet.ExtractDocumentationAsJsonDoclet</doclet>
              <docletArtifact>
                <groupId>capital.scalable</groupId>
                <artifactId>spring-auto-restdocs-json-doclet</artifactId>
                <version>2.0.9</version>
              </docletArtifact>
              <destDir>generated-javadoc-json</destDir>
              <reportOutputDirectory>${project.build.directory}</reportOutputDirectory>
              <useStandardDocletOptions>false</useStandardDocletOptions>
              <show>package</show>
            </configuration>
          </execution>

从 AutoDocumentation.sectionBuilder().snippetNames(...)

中删除 SnippetRegistry.AUTO_METHOD_PATHSnippetRegistry.AUTO_DESCRIPTION
// from
AutoDocumentation.sectionBuilder().snippetNames(
                    AUTO_METHOD_PATH,
                    AUTO_DESCRIPTION,
                    AUTO_AUTHORIZATION,
                    ...
                    ).build();

// to
AutoDocumentation.sectionBuilder().snippetNames(
                    AUTO_AUTHORIZATION,
                    ...
                    ).build();