/** * Find unused artifacts. * * @param env Environment * @return Collection of unused artifacts */ private static Collection<String> used(final MavenEnvironment env) { final ProjectDependencyAnalysis analysis = DependenciesValidator.analyze(env); final Collection<String> used = new LinkedList<String>(); for (final Object artifact : analysis.getUsedUndeclaredArtifacts()) { used.add(artifact.toString()); } return used; }
/** * Find unused artifacts. * * @param env Environment * @return Collection of unused artifacts */ private static Collection<String> unused(final MavenEnvironment env) { final ProjectDependencyAnalysis analysis = DependenciesValidator.analyze(env); final Collection<String> unused = new LinkedList<String>(); for (final Object obj : analysis.getUnusedDeclaredArtifacts()) { final Artifact artifact = (Artifact) obj; if (!artifact.getScope().equals(Artifact.SCOPE_COMPILE)) { continue; } unused.add(artifact.toString()); } return unused; }