Minor issues with default javadoc task

I found 2 minor issues with the default javadoc task, build script is shown below:

  1. ‘classpath’ does not contain additional custom entries in main source set’s ‘compileClasspath’. User Guide lists the default of classpath as ‘sourceSets.main.output + sourceSets.main.compileClasspath’, but it does not find classes in configurations that I add to main’s compileClasspath in the build script. Classes from default classpath (configuration compile) are found. I suspect an evaluation order problem in JavaPlugin.

  2. source compatibility option does not default to the ‘sourceCompatibility’ convention property of the Java plugin.This is not claimed anywhere in the docs, but I would find it very logical.

Both issues are very minor, as the settings can easily be made explicitly. I found them when converting a number of small legacy projects to gradle (with source that’s only compatible to Java 1.4).

Here’s the script (excerpt):

apply plugin: "java"
apply plugin: "maven"
  version = "2.3.1-inxfix"
sourceCompatibility = 1.4
  configurations {
 provided
}
  dependencies {
 compile group: "javax.mail", name:"javamail", version:"1.4.5", configuration:"api"
 provided "javax.servlet:servletapi:2.5"
}
sourceSets {
 main {
  compileClasspath += configurations.provided
 }
}
  javadoc {
 // defaults to main.compileClasspath but does not find above provided dependency w/o setting classpath explicitely
 classpath += configurations.provided
   // would expect that to be default
 options.source = "$sourceCompatibility"
}