Javadoc task fails while build executes ok

I built a small project using gradle and the netbeans-gradle plugin. Compiling, testing, creating war file, and running in Jetty all work fine, without any warnings or errors.

However if I try to run the default javadoc task I get several “package does not exist” and “symbol not found” errors. According to documentation, javadoc should use the compile classpath by default, so how can javadoc fail while compile succeeds?

Here is my build.gradle:

apply plugin: 'jetty'

sourceCompatibility = '1.6’
targetCompatibility = ‘1.6’

httpPort = 9090

[jettyRun, jettyStop].stopPort = 8091;
[jettyRun, jettyStop]
.stopKey = ‘stopKey’

task sourceDist(type: Jar, dependsOn: build) {
from(‘src’) {
into ‘src’
}
from(’.hg’) {
into ‘.hg’
}
from(“build.gradle”)
baseName = 'registration-src’
destinationDir = file(‘build/distributions’)
}

task wrapper(type: Wrapper) {
gradleVersion = '2.6’
distributionUrl = 'file:///home/normand/zip/gradle-2.6-bin.zip’
distributionPath = Wrapper.PathBase.PROJECT
archiveBase = Wrapper.PathBase.PROJECT
}

repositories {
flatDir {
dirs ‘lib’
}
}

dependencies {
compile fileTree(dir: ‘lib’, include: ‘.jar’)
runtime fileTree(dir: ‘lib’, include: '
.jar’)
testCompile fileTree(dir: ‘lib’, include: ‘.jar’)
testRuntime fileTree(dir: ‘lib’, include: '
.jar’)
providedCompile ‘javax.servlet:servlet-api:2.4’
}