@Override protected List<File> getDependencies() { ArrayList<File> dependencies = new ArrayList<File>(); @SuppressWarnings("unchecked") final Iterator<Artifact> it = project.getArtifacts().iterator(); while (it.hasNext()) { final Artifact declared = it.next(); this.log.debug("Checking artifact " + declared); if (this.isJavaArtifact(declared)) { if (Artifact.SCOPE_COMPILE.equals(declared.getScope()) || Artifact.SCOPE_RUNTIME.equals(declared.getScope()) || Artifact.SCOPE_PROVIDED.equals(declared.getScope()) || Artifact.SCOPE_SYSTEM.equals(declared.getScope())) { this.log.debug("Resolving artifact " + declared); if (declared.getFile() != null) { dependencies.add(declared.getFile()); } else { this.log.debug("Unable to resolve artifact " + declared); } } else { this.log.debug( "Artifact " + declared + " has not scope compile or runtime, but " + declared.getScope()); } } else { this.log.debug( "Artifact " + declared + " is not a java artifact, type is " + declared.getType()); } } return dependencies; }
@Override protected Iterator<File> getSourceFiles() { ArrayList<File> files = new ArrayList<File>(); @SuppressWarnings("unchecked") final Iterator<String> i = project.getCompileSourceRoots().iterator(); // FELIX-509: check for excludes String[] includes = new String[] {"**/*.java"}; if (includeString != null) { includes = StringUtils.split(includeString, ","); } final String[] excludes; if (excludeString != null) { excludes = StringUtils.split(excludeString, ","); } else { excludes = null; } while (i.hasNext()) { final String tree = i.next(); final File directory = new File(tree); if (!directory.exists()) { this.log.warn("Source tree does not exist. Ignoring " + tree); continue; } this.log.debug("Scanning source tree " + tree); final DirectoryScanner scanner = new DirectoryScanner(); scanner.setBasedir(directory); if (excludes != null && excludes.length > 0) { scanner.setExcludes(excludes); } scanner.addDefaultExcludes(); scanner.setIncludes(includes); scanner.scan(); for (String fileName : scanner.getIncludedFiles()) { files.add(new File(directory, fileName)); } } return files.iterator(); }