39
39
import org .apache .maven .execution .MavenSession ;
40
40
import org .apache .maven .model .ReportPlugin ;
41
41
import org .apache .maven .model .Reporting ;
42
+ import org .apache .maven .plugin .MojoExecution ;
42
43
import org .apache .maven .plugins .annotations .Component ;
43
44
import org .apache .maven .plugins .annotations .Parameter ;
44
45
import org .apache .maven .project .MavenProject ;
@@ -160,12 +161,12 @@ public abstract class AbstractPmdReport extends AbstractMavenReport {
160
161
protected boolean aggregate ;
161
162
162
163
/**
163
- * Whether to include the xml files generated by PMD/CPD in the site .
164
+ * Whether to include the XML files generated by PMD/CPD in the {@link #getReportOutputDirectory()} .
164
165
*
165
166
* @since 3.0
166
167
*/
167
168
@ Parameter (defaultValue = "false" )
168
- protected boolean includeXmlInSite ;
169
+ protected boolean includeXmlInReports ;
169
170
170
171
/**
171
172
* Skip the PMD/CPD report generation if there are no violations or duplications found. Defaults to
@@ -252,12 +253,6 @@ public abstract class AbstractPmdReport extends AbstractMavenReport {
252
253
// Read-only parameters
253
254
// ----------------------------------------------------------------------
254
255
255
- /**
256
- * The projects in the reactor for aggregation report.
257
- */
258
- @ Parameter (property = "reactorProjects" , readonly = true )
259
- protected List <MavenProject > reactorProjects ;
260
-
261
256
/**
262
257
* The current build session instance. This is used for
263
258
* toolchain manager API calls and for dependency resolver API calls.
@@ -276,6 +271,14 @@ protected MavenProject getProject() {
276
271
return project ;
277
272
}
278
273
274
+ protected List <MavenProject > getReactorProjects () {
275
+ return reactorProjects ;
276
+ }
277
+
278
+ protected MojoExecution getMojoExecution () {
279
+ return mojoExecution ;
280
+ }
281
+
279
282
protected String constructXRefLocation (boolean test ) {
280
283
String location = null ;
281
284
if (linkXRef ) {
@@ -460,11 +463,7 @@ protected boolean isXml() {
460
463
return "xml" .equals (format );
461
464
}
462
465
463
- /**
464
- * {@inheritDoc}
465
- */
466
- @ Override
467
- public boolean canGenerateReport () {
466
+ protected boolean canGenerateReportInternal () throws MavenReportException {
468
467
if (!showPmdLog && !warnedAboutShowPmdLog ) {
469
468
getLog ().warn ("The parameter \" showPmdLog\" has been deprecated and will be removed."
470
469
+ "Setting it to \" false\" has no effect." );
@@ -490,7 +489,7 @@ public boolean canGenerateReport() {
490
489
return false ;
491
490
}
492
491
} catch (IOException e ) {
493
- getLog (). error ( e );
492
+ throw new MavenReportException ( "Failed to determine files to process for PMD" , e );
494
493
}
495
494
return true ;
496
495
}
0 commit comments