【问题标题】:Enunciate CXF plugin for JAX-RS为 JAX-RS 阐明 CXF 插件
【发布时间】:2011-03-14 02:41:23
【问题描述】:

我正在尝试使用 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 对象返回类型和参数没有被记录。

【问题讨论】:

    标签: maven maven-plugin cxf jax-rs enunciate


    【解决方案1】:

    试试这个:

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

    根据docs,可能需要添加一些插件依赖。

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

    【讨论】:

    • 谢谢。我昨晚用你提到的类似方法解决了这个问题。我只是没有时间发布更新。
    • 回复:关于 JSON 对象的更新。 Enunciate 似乎不能很好地处理 JSON 对象。但是,我能够让它记录我的 JSON 返回类型。有关详细信息,请参阅邮件列表上的此线程:archive.codehaus.org/lists/org.codehaus.enunciate.user/msg/…
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-24
    • 1970-01-01
    • 2013-12-18
    • 1970-01-01
    • 1970-01-01
    • 2014-09-11
    相关资源
    最近更新 更多