Skip to content

Commit d28e98b

Browse files
pzygielomichael-o
authored andcommitted
[MPIR-413] Plugin repositories defined in project are not used by plugin management report
This closes #32
1 parent 99bfaef commit d28e98b

File tree

2 files changed

+12
-20
lines changed

2 files changed

+12
-20
lines changed

src/main/java/org/apache/maven/report/projectinfo/PluginManagementReport.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,17 @@
5353
public class PluginManagementReport
5454
extends AbstractProjectInfoReport
5555
{
56-
56+
5757
/**
5858
* Specify the excluded plugins. This can be a list of artifacts in the format
5959
* groupId[:artifactId[:type[:version]]]. <br>
6060
* Plugins matching any exclude will not be present in the report.
61-
*
61+
*
6262
* @since 3.0.1
6363
*/
6464
@Parameter
6565
private List<String> pluginManagementExcludes = null;
66-
66+
6767
// ----------------------------------------------------------------------
6868
// Public methods
6969
// ----------------------------------------------------------------------
@@ -128,7 +128,7 @@ protected static class PluginManagementRenderer
128128
private final RepositorySystem repositorySystem;
129129

130130
private final ProjectBuildingRequest buildingRequest;
131-
131+
132132
private final PatternExcludesArtifactFilter patternExcludesArtifactFilter;
133133

134134
/**
@@ -206,7 +206,7 @@ private void renderSectionPluginManagement()
206206

207207
ProjectBuildingRequest buildRequest = new DefaultProjectBuildingRequest( buildingRequest );
208208
buildRequest.setRemoteRepositories( project.getPluginArtifactRepositories() );
209-
209+
210210
for ( Plugin plugin : pluginManagement )
211211
{
212212
VersionRange versionRange;
@@ -227,14 +227,14 @@ private void renderSectionPluginManagement()
227227
try
228228
{
229229
MavenProject pluginProject =
230-
projectBuilder.build( pluginArtifact, buildingRequest ).getProject();
230+
projectBuilder.build( pluginArtifact, buildRequest ).getProject();
231231

232232
tableRow( getPluginRow( pluginProject.getGroupId(), pluginProject.getArtifactId(),
233233
pluginProject.getVersion(), pluginProject.getUrl() ) );
234234
}
235235
catch ( ProjectBuildingException e )
236236
{
237-
log.info( "Could not build project for: " + plugin.getArtifactId() + ":" + e.getMessage(), e );
237+
log.info( "Could not build project for " + plugin.getArtifactId(), e );
238238
tableRow( getPluginRow( plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion(),
239239
null ) );
240240
}

src/main/java/org/apache/maven/report/projectinfo/PluginsReport.java

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import java.util.Locale;
2727

2828
import org.apache.maven.artifact.Artifact;
29-
import org.apache.maven.artifact.repository.ArtifactRepository;
3029
import org.apache.maven.artifact.versioning.VersionRange;
3130
import org.apache.maven.doxia.sink.Sink;
3231
import org.apache.maven.model.Plugin;
@@ -173,7 +172,7 @@ public void renderBody()
173172
private void renderSectionPlugins( boolean isPlugins )
174173
{
175174
List<GAV> list = isPlugins ? GAV.pluginsToGAV( plugins ) : GAV.reportPluginsToGAV( reports, project );
176-
175+
177176
String[] tableHeader = getPluginTableHeader();
178177

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

194-
List<ArtifactRepository> artifactRepositories = project.getPluginArtifactRepositories();
195-
if ( artifactRepositories == null )
196-
{
197-
artifactRepositories = new ArrayList<>();
198-
}
199-
200193
ProjectBuildingRequest buildRequest = new DefaultProjectBuildingRequest( buildingRequest );
201-
buildRequest.setRemoteRepositories( artifactRepositories );
202-
194+
buildRequest.setRemoteRepositories( project.getPluginArtifactRepositories() );
195+
203196
for ( GAV plugin : list )
204197
{
205198
VersionRange versionRange = VersionRange.createFromVersion( plugin.getVersion() );
206199

207-
200+
208201
Artifact pluginArtifact =
209202
repositorySystem.createProjectArtifact( plugin.getGroupId(), plugin.getArtifactId(),
210203
versionRange.toString() );
@@ -217,11 +210,10 @@ private void renderSectionPlugins( boolean isPlugins )
217210
}
218211
catch ( ProjectBuildingException e )
219212
{
220-
log.info( "Could not build project for " + plugin.getArtifactId() + ": " + e.getMessage(), e );
213+
log.info( "Could not build project for " + plugin.getArtifactId(), e );
221214
tableRow( getPluginRow( plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion(),
222215
null ) );
223216
}
224-
225217
}
226218
endTable();
227219

0 commit comments

Comments
 (0)