use of org.apache.maven.project.ProjectBuildingRequest in project maven-plugins by apache.
the class ResolvePluginsMojo method resolvePluginArtifacts.
/**
* This method resolves the plugin artifacts from the project.
*
* @return set of resolved plugin artifacts.
* @throws ArtifactFilterException in case of an error.
* @throws ArtifactResolverException in case of an error.
*/
protected Set<Artifact> resolvePluginArtifacts() throws ArtifactFilterException, ArtifactResolverException {
final Set<Artifact> plugins = getProject().getPluginArtifacts();
final Set<Artifact> reports = getProject().getReportArtifacts();
Set<Artifact> artifacts = new LinkedHashSet<Artifact>();
artifacts.addAll(reports);
artifacts.addAll(plugins);
final FilterArtifacts filter = getPluginArtifactsFilter();
artifacts = filter.filter(artifacts);
Set<Artifact> resolvedArtifacts = new LinkedHashSet<Artifact>(artifacts.size());
// final ArtifactFilter filter = getPluginFilter();
for (final Artifact artifact : new LinkedHashSet<Artifact>(artifacts)) {
// if ( !filter.include( artifact ) )
// {
// final String logStr =
// String.format( " Plugin SKIPPED: %s", DependencyUtil.getFormattedFileName( artifact, false ) );
//
// if ( !silent )
// {
// this.getLog().info( logStr );
// }
//
// artifacts.remove( artifact );
// continue;
// }
ProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest(session.getProjectBuildingRequest());
buildingRequest.setRemoteRepositories(this.remotePluginRepositories);
// resolve the new artifact
resolvedArtifacts.add(getArtifactResolver().resolveArtifact(buildingRequest, artifact).getArtifact());
}
return artifacts;
}
Aggregations