private void addResourcesIfNecessary() { if (this.addResources) { SourceSet mainSourceSet = SourceSets.findMainSourceSet(getProject()); final File outputDir = (mainSourceSet == null ? null : mainSourceSet.getOutput().getResourcesDir()); final Set<File> resources = new LinkedHashSet<File>(); if (mainSourceSet != null) { resources.addAll(mainSourceSet.getResources().getSrcDirs()); } List<File> classPath = new ArrayList<File>(getClasspath().getFiles()); classPath.addAll(0, resources); getLogger().info("Adding classpath: " + resources); setClasspath(new SimpleFileCollection(classPath)); if (outputDir != null) { for (File directory : resources) { FileUtils.removeDuplicatesFromOutputDirectory(outputDir, directory); } } } }
private void addResources(List<URL> urls) throws IOException { if (this.addResources) { for (Resource resource : this.project.getResources()) { File directory = new File(resource.getDirectory()); urls.add(directory.toURI().toURL()); FileUtils.removeDuplicatesFromOutputDirectory(this.classesDirectory, directory); } } }