In an effort to follow Peter's suggestion for making my Javadoc generation 
(with a fancy doclet) cleaner, I am attempting to get something working 
currently with AntBuilder.javadoc to work with Gradle's Javadoc task.

This is what works:

task generateRestApiDocs(dependsOn: clean) << {
  ant.javadoc(
          classpath: configurations.compile.asPath,
          sourcepath: file("src/main/java"),
          destdir: "${reportsDir.absolutePath}/rest-api-docs",
          docletpath: configurations.jaxDoclet.asPath) {
    doclet(name: "com.lunatech.doclets.jax.jaxrs.JAXRSDoclet") {
      param name:"-jaxrscontext", value:"http://localhost:8080/$webContext";
    }
  }
}

Here is the approximate equivalent using the Javadoc task:

task generateRestApiDocs(dependsOn: cleanJavadoc, type: Javadoc)  {
  destinationDir = file("${reportsDir.absolutePath}/rest-api-docs")
  options.docletpath = configurations.jaxDoclet.files.asType(List)
  options.doclet = "com.lunatech.doclets.jax.jaxrs.JAXRSDoclet"
  options.optionFiles = [file("rest-api-javadoc.options")]
}

It is cool that this is less verbose, but this doesn't work for me. I don't get 
an error, but nothing happens. I do find this message though: "Execution 
stopped by some action with message: File collection does not contain any 
files." I am simply relying on the default source path for the Javadoc task, 
which is specified explicitly in the AntBuilder Javadoc version. Or so I 
thought.

Any insight into what I am missing is appreciated.

Incidentally, is there a way to specify the doclet-specific arguments without 
an options file?

Thanks.

Reply via email to