use of org.apache.maven.shared.artifact.filter.ScopeArtifactFilter in project maven-plugins by apache.
the class DefaultRepositoryAssembler method buildRepositoryFilter.
private ArtifactFilter buildRepositoryFilter(RepositoryInfo repository, MavenProject project) {
AndArtifactFilter filter = new AndArtifactFilter();
ArtifactFilter scopeFilter = new ScopeArtifactFilter(repository.getScope());
filter.add(scopeFilter);
// ----------------------------------------------------------------------------
// Includes
//
// We'll take everything if no includes are specified to try and make
// this
// process more maintainable. Don't want to have to update the assembly
// descriptor everytime the POM is updated.
// ----------------------------------------------------------------------------
List<String> includes = repository.getIncludes();
if ((includes == null) || includes.isEmpty()) {
List<String> patterns = new ArrayList<String>();
Set<Artifact> projectArtifacts = project.getDependencyArtifacts();
if (projectArtifacts != null) {
for (Artifact artifact : projectArtifacts) {
patterns.add(artifact.getDependencyConflictId());
}
}
PatternIncludesArtifactFilter includeFilter = new PatternIncludesArtifactFilter(patterns, true);
filter.add(includeFilter);
} else {
filter.add(new PatternIncludesArtifactFilter(repository.getIncludes(), true));
}
// ----------------------------------------------------------------------------
// Excludes
//
// We still want to make it easy to exclude a few things even if we
// slurp
// up everything.
// ----------------------------------------------------------------------------
List<String> excludes = repository.getExcludes();
if ((excludes != null) && !excludes.isEmpty()) {
filter.add(new PatternExcludesArtifactFilter(repository.getExcludes(), true));
}
return filter;
}
Aggregations