use of org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter in project syndesis by syndesisio.
the class RepackageExtensionMojo method getAdditionalFilters.
@Override
protected Collection<ArtifactsFilter> getAdditionalFilters() {
Collection<MavenDependency> dependencies = new HashSet<>();
if (StringUtils.isNotBlank(blackListedBoms)) {
addCustomBoms(dependencies);
} else {
addDefaultBOMs(dependencies);
}
if (StringUtils.isNotBlank(blackListedGAVs)) {
addCustomGAVs(dependencies);
} else {
addDefaultGAVs(dependencies);
}
if (getLog().isDebugEnabled()) {
getLog().debug("Filtering out dependencies from the following BOMs: " + bomsUsed);
getLog().debug("Dependencies to be filtered out:");
dependencies.stream().sorted(Comparator.comparing(MavenCoordinate::toCanonicalForm)).forEach(mavenDependency -> getLog().debug(mavenDependency.toCanonicalForm()));
}
List<ArtifactsFilter> filters = new ArrayList<>(dependencies.size());
for (MavenCoordinate dep : dependencies) {
filters.add(newExcludeFilter(dep));
}
return filters;
}
use of org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter in project spring-boot by spring-projects.
the class RepackageMojo method getAdditionalFilters.
private ArtifactsFilter[] getAdditionalFilters() {
List<ArtifactsFilter> filters = new ArrayList<>();
if (this.excludeDevtools) {
Exclude exclude = new Exclude();
exclude.setGroupId("org.springframework.boot");
exclude.setArtifactId("spring-boot-devtools");
ExcludeFilter filter = new ExcludeFilter(exclude);
filters.add(filter);
}
if (!this.includeSystemScope) {
filters.add(new ScopeFilter(null, Artifact.SCOPE_SYSTEM));
}
return filters.toArray(new ArtifactsFilter[filters.size()]);
}
use of org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter in project spring-boot by spring-projects.
the class AbstractPackagerMojo method getAdditionalFilters.
private ArtifactsFilter[] getAdditionalFilters() {
List<ArtifactsFilter> filters = new ArrayList<>();
if (this.excludeDevtools) {
Exclude exclude = new Exclude();
exclude.setGroupId("org.springframework.boot");
exclude.setArtifactId("spring-boot-devtools");
ExcludeFilter filter = new ExcludeFilter(exclude);
filters.add(filter);
}
if (!this.includeSystemScope) {
filters.add(new ScopeFilter(null, Artifact.SCOPE_SYSTEM));
}
return filters.toArray(new ArtifactsFilter[0]);
}
use of org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter in project spring-boot by spring-projects.
the class AbstractDependencyFilterMojo method getFilters.
/**
* Return artifact filters configured for this MOJO.
* @param additionalFilters optional additional filters to apply
* @return the filters
*/
protected final FilterArtifacts getFilters(ArtifactsFilter... additionalFilters) {
FilterArtifacts filters = new FilterArtifacts();
for (ArtifactsFilter additionalFilter : additionalFilters) {
filters.addFilter(additionalFilter);
}
filters.addFilter(new MatchingGroupIdFilter(cleanFilterConfig(this.excludeGroupIds)));
if (this.includes != null && !this.includes.isEmpty()) {
filters.addFilter(new IncludeFilter(this.includes));
}
if (this.excludes != null && !this.excludes.isEmpty()) {
filters.addFilter(new ExcludeFilter(this.excludes));
}
filters.addFilter(new JarTypeFilter());
return filters;
}
use of org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter in project syndesis by syndesisio.
the class SupportMojo method filterDependencies.
@Override
protected Set<Artifact> filterDependencies(Set<Artifact> dependencies, FilterArtifacts filters) throws MojoExecutionException {
try {
Set<Artifact> filtered = new LinkedHashSet<Artifact>(dependencies);
@SuppressWarnings("unchecked") Collection<ArtifactsFilter> filtersToUse = filters.getFilters();
filtersToUse.addAll(getAdditionalFilters());
filtered.retainAll(filters.filter(dependencies));
return filtered;
} catch (ArtifactFilterException ex) {
throw new MojoExecutionException(ex.getMessage(), ex);
}
}
Aggregations