Levi Hoogenberg wrote:
I'm trying to upgrade one of my projects from Gradle 0.7 to Gradle 0.8. The project has a number of subprojects, for which I'd like to generate combined Javadocs. At the moment, I have the following in my root build.gradle:

task apidocs(type: Javadoc, visible: false)  {
    destinationDir = new File(project.buildDir, 'docs/api')

    srcDirs = []
    options.links = ['http://java.sun.com/javase/6/docs/api/']

    subprojects.each {subproject ->
        subproject.sourceSets.each {sourceSet ->
            sourceSet.java.srcDirs.each {srcDir ->
                srcDirs << srcDir
            }
        }

        if (classpath) {
            classpath += subproject.configurations.apidocs
        } else {
            classpath = subproject.configurations.apidocs
        }

        if (subproject.hasProperty('apidocUrls')) {
            options.links += subproject.property('apidocUrls')
        }
    }
}


The srcDirs property was replaced with the source property in 0.8. You could do something like:

subprojects.each {subproject ->
   subproject.sourceSets.each {sourceSet ->
       source sourceSet.allJava
   }
}

or, more concisely

source subprojects*.sourceSets*.allJava

I have a couple of questions:

- in the 0.7 version, I used the options' classpath property, but that seems to be removed. My current approach seems a bit clumsy - is there a more elegant way?

It was removed from the options. It was on the task and the options. Now it's just on the task.

To assemble the classpath, you could do something like:

classpath = files(subprojects*.configurations*.apidocs)

Another option would be to use a configuration to declare the classpath:

dependencies {
    subprojects.each {
        apidocs project(path: it.path, configuration: apidocs)
   }
}

javadoc {
   classpath = configurations.apidocs
}

- the build fails with the message /No value has been specified for property 'optionsFile'/. Is optionsFile intended to be required?


It shouldn't be - could you add a JIRA issue for this?


--
Adam Murdoch
Gradle Developer
http://www.gradle.org

Reply via email to