Skip to content

Commit

Permalink
[MPIR-413] Plugin repositories defined in project are not used by plu…
Browse files Browse the repository at this point in the history
…gin management report

This closes #32
  • Loading branch information
pzygielo authored and michael-o committed Feb 21, 2022
1 parent 99bfaef commit d28e98b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@
public class PluginManagementReport
extends AbstractProjectInfoReport
{

/**
* Specify the excluded plugins. This can be a list of artifacts in the format
* groupId[:artifactId[:type[:version]]]. <br>
* Plugins matching any exclude will not be present in the report.
*
*
* @since 3.0.1
*/
@Parameter
private List<String> pluginManagementExcludes = null;

// ----------------------------------------------------------------------
// Public methods
// ----------------------------------------------------------------------
Expand Down Expand Up @@ -128,7 +128,7 @@ protected static class PluginManagementRenderer
private final RepositorySystem repositorySystem;

private final ProjectBuildingRequest buildingRequest;

private final PatternExcludesArtifactFilter patternExcludesArtifactFilter;

/**
Expand Down Expand Up @@ -206,7 +206,7 @@ private void renderSectionPluginManagement()

ProjectBuildingRequest buildRequest = new DefaultProjectBuildingRequest( buildingRequest );
buildRequest.setRemoteRepositories( project.getPluginArtifactRepositories() );

for ( Plugin plugin : pluginManagement )
{
VersionRange versionRange;
Expand All @@ -227,14 +227,14 @@ private void renderSectionPluginManagement()
try
{
MavenProject pluginProject =
projectBuilder.build( pluginArtifact, buildingRequest ).getProject();
projectBuilder.build( pluginArtifact, buildRequest ).getProject();

tableRow( getPluginRow( pluginProject.getGroupId(), pluginProject.getArtifactId(),
pluginProject.getVersion(), pluginProject.getUrl() ) );
}
catch ( ProjectBuildingException e )
{
log.info( "Could not build project for: " + plugin.getArtifactId() + ":" + e.getMessage(), e );
log.info( "Could not build project for " + plugin.getArtifactId(), e );
tableRow( getPluginRow( plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion(),
null ) );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import java.util.Locale;

import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.versioning.VersionRange;
import org.apache.maven.doxia.sink.Sink;
import org.apache.maven.model.Plugin;
Expand Down Expand Up @@ -173,7 +172,7 @@ public void renderBody()
private void renderSectionPlugins( boolean isPlugins )
{
List<GAV> list = isPlugins ? GAV.pluginsToGAV( plugins ) : GAV.reportPluginsToGAV( reports, project );

String[] tableHeader = getPluginTableHeader();

startSection( getI18nString( isPlugins ? "build.title" : "report.title" ) );
Expand All @@ -191,20 +190,14 @@ private void renderSectionPlugins( boolean isPlugins )
startTable();
tableHeader( tableHeader );

List<ArtifactRepository> artifactRepositories = project.getPluginArtifactRepositories();
if ( artifactRepositories == null )
{
artifactRepositories = new ArrayList<>();
}

ProjectBuildingRequest buildRequest = new DefaultProjectBuildingRequest( buildingRequest );
buildRequest.setRemoteRepositories( artifactRepositories );
buildRequest.setRemoteRepositories( project.getPluginArtifactRepositories() );

for ( GAV plugin : list )
{
VersionRange versionRange = VersionRange.createFromVersion( plugin.getVersion() );


Artifact pluginArtifact =
repositorySystem.createProjectArtifact( plugin.getGroupId(), plugin.getArtifactId(),
versionRange.toString() );
Expand All @@ -217,11 +210,10 @@ private void renderSectionPlugins( boolean isPlugins )
}
catch ( ProjectBuildingException e )
{
log.info( "Could not build project for " + plugin.getArtifactId() + ": " + e.getMessage(), e );
log.info( "Could not build project for " + plugin.getArtifactId(), e );
tableRow( getPluginRow( plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion(),
null ) );
}

}
endTable();

Expand Down

0 comments on commit d28e98b

Please sign in to comment.