0

我正在尝试使用 CXF 的 Enunciate 插件通过配置如下的 Maven 插件为我的 REST 接口生成文档:

<plugin>
  <groupId>org.codehaus.enunciate</groupId>
  <artifactId>maven-enunciate-cxf-plugin</artifactId>
  <!-- check for the latest version -->
  <version>1.21</version>
  <executions>
    <execution>
      <goals>
        <goal>docs</goal>
      </goals>
      <configuration>

        <!-- the directory where to put the docs -->
        <docsDir>${project.build}/docs </docsDir>

      </configuration>
    </execution>
  </executions>
</plugin>

但是当我尝试运行插件时,我从命令行收到错误命令:

mvn clean install

错误是:

[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] 'docs' was specified in an execution, but not found in the plugin
[INFO] ------------------------------------------------------------------------

有什么建议么?

提前致谢,

马克

更新:我将插件更改为:

  <plugin>
    <groupId>org.codehaus.enunciate</groupId>
    <artifactId>maven-enunciate-plugin</artifactId>
    <version>1.21</version>
    <executions>
      <execution>
        <goals>
          <goal>docs</goal>
        </goals>
        <configuration>
          <docsDir>${project.build}/docs </docsDir>
        </configuration>
      </execution>
    </executions>
    <dependencies>
      <dependency>
        <groupId>org.codehaus.enunciate</groupId>
        <artifactId>enunciate-rest</artifactId>
        <version>1.21</version>
      </dependency>
      <dependency>
        <groupId>org.codehaus.enunciate</groupId>
        <artifactId>enunciate-cxf-rt</artifactId>
        <version>1.21</version>
      </dependency>
    </dependencies>
  </plugin>

它可以工作,但我的 JSON 对象返回类型和参数没有被记录。

4

1 回答 1

1

试试这个:

<artifactId>maven-enunciate-plugin</artifactId>

根据文档,您可能需要添加一些插件依赖项。

artifactId在我的 Maven 项目中使用上面的 CXF 来使用 Enunciate 生成文档,没有任何问题。

于 2011-03-14T02:49:50.267 回答