【问题标题】:How can I generate Enunciate documentation in a gradle build如何在 gradle 构建中生成 Enunciate 文档
【发布时间】:2014-09-24 23:21:51
【问题描述】:

Enunciate 目前没有 gradle 插件 (https://jira.codehaus.org/browse/ENUNCIATE-815)。有什么方法可以手动从 Gradle 触发构建文档?

【问题讨论】:

标签: gradle enunciate


【解决方案1】:

我发现从命令行运行它时需要提供各种 JAX-RS JAR 文件以进行发音。使用 Gradle 中的configurations.runtime.asPath 属性非常简单,它通过了我在构建项目时已经解决的所有RESTEasy 工件。

import org.apache.tools.ant.taskdefs.condition.Os

task enunciate(type:Exec) {
  if (Os.isFamily(Os.FAMILY_WINDOWS)) {
      //on windows:
      commandLine 'cmd', '/c', 
      'enunciate-1.29\\bin\\enunciate.bat  -Edocs docs -f enunciate.xml -cp "' + configurations.runtime.asPath + 
      '" src/com/company/rest/RestApi.java'
  } else {
      //on linux
      commandLine './enunciate-1.29/bin/enunciate -Edocs docs -f enunciate.xml -cp "' + configurations.runtime.asPath + 
      " src/com/company/rest/RestApi.java'
  }

  //store the output instead of printing to the console:
  standardOutput = new ByteArrayOutputStream()

  //extension method stopTomcat.output() can be used to obtain the output:
  ext.output = {
    return standardOutput.toString()
  }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-25
    • 1970-01-01
    • 2010-09-11
    • 1970-01-01
    • 2020-04-13
    • 1970-01-01
    相关资源
    最近更新 更多