private static JavaSourceSet adjustedSources(
JavaSourceSet sourceSet,
Map<File, File> dependencyMap) {
JavaClassPaths origClassPaths = sourceSet.getClasspaths();
Collection<File> compile = adjustedClassPaths(origClassPaths.getCompileClasspaths(), dependencyMap);
Collection<File> runtime = adjustedClassPaths(origClassPaths.getRuntimeClasspaths(), dependencyMap);
runtime.remove(sourceSet.getOutputDirs().getClassesDir());
runtime.remove(sourceSet.getOutputDirs().getResourcesDir());
JavaClassPaths classPaths = new JavaClassPaths(compile, runtime);
JavaSourceSet.Builder result = new JavaSourceSet.Builder(sourceSet.getName(), sourceSet.getOutputDirs());
result.setClasspaths(classPaths);
result.setCompileClassPathProblem(sourceSet.getCompileClassPathProblem());
result.setRuntimeClassPathProblem(sourceSet.getRuntimeClassPathProblem());