1

現在、Enunciate には gradle プラグインがありません ( https://jira.codehaus.org/browse/ENUNCIATE-815 )。Gradle からドキュメントのビルドを手動でトリガーする方法はありますか?

4

1 に答える 1

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()
  }
}
于 2014-09-24T23:21:51.910 に答える