On 12/03/2011, at 4:42 AM, Neil Chaudhuri wrote:

> 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.

The default for tasks of type Javadoc is to have no source. You'll need to tell 
the task which source files to document:

source = sourceSets.main.allJava

>  
> Any insight into what I am missing is appreciated.
>  
> Incidentally, is there a way to specify the doclet-specific arguments without 
> an options file?

Not yet. Could you add a JIRA issue for this?


--
Adam Murdoch
Gradle Developer
http://www.gradle.org
Co-Founder and VP of Engineering, Gradleware Inc. - Gradle Training, Support, 
Consulting
http://www.gradleware.com

Reply via email to