Something like the following might get you a wee bit further..
task generateRestApiDocs(dependsOn: configurations.jaxDoclet) << {
ant.javadoc( classpath: configurations.jaxDoclet.asPath,
sourcepath: file("src/main/java"), destdir:
file("${reportsDirName}/rest-api-docs"), docletpath:
configurations.jaxDoclet.asPath) { doclet(name:
"com.lunatech.doclets.jax.jaxrs.JAXRSDoclet") { param
name:"-jaxrscontext", value:"http://localhost:8080/" + webContext } }}
A few comments...classpathref and docletpathref assumes that you have
previously defined a id reference which in your sample you haven't. So your
error was that there was no reference with the id corresponding to
configurations.jaxDoclet.asPath (which would be the concatinated classpath of
your dependencies as a string).
you would have had the same problem if you tried to reference an id in ant that
you hadn't defined.
cheersMagnus
From: [email protected]
To: [email protected]
Date: Mon, 7 Mar 2011 13:13:07 -0600
Subject: [gradle-user] Classpath for Javadoc Task with AntBuilder
I am using AntBuilder in Gradle to run a third-party Javadoc doclet, but I get
an error saying “Caused by: Reference <all the jar files in my classpath like
Spring, etc. separated by semicolons> not found.” Here are the relevant
snippets: configurations { jaxDoclet { extendsFrom compile }} dependencies {
compile group: springFrameworkGroup, name: "spring-web", version:
springFrameworkVersion... jaxDoclet group: "com.lunatech.doclets", name:
"jax-doclets", version: "0.7"} task generateRestApiDocs(dependsOn:
configurations.jaxDoclet) << { ant.javadoc( classpathref:
configurations.jaxDoclet.asPath, sourcepath:
file("src${File.separator}main${File.separator}java"), destdir:
"${reportsDirName}${File.separator}rest-api-docs", docletpathref:
configurations.jaxDoclet.asPath) { doclet(name:
"com.lunatech.doclets.jax.jaxrs.JAXRSDoclet") { param
name:"-jaxrscontext", value:"http://localhost:8080/" + webContext } }} Can
you please provide insight into how I should adjust my configuration to get
this to work? On a far less important note, it would be nice to know if there
is a more elegant way to specify that my sourcepath is “src/main/java.” Thanks.