FileCollection (SourceSet sourceSet) { final String compileTaskName = sourceSet.getCompileJavaTaskName(); Task compileTask = myProject.getTasks().findByName(compileTaskName); if (compileTask instanceof AbstractCompile) { try { return ((AbstractCompile)compileTask).getClasspath(); } catch (Exception e) { LOG.warn("Error obtaining compile classpath for java compilation task for [" + sourceSet.getName() + "] in project [" + myProject.getPath() + "]", e); } } return sourceSet.getCompileClasspath(); }