Skip to content

Commit 7cd3904

Browse files
committed
[JXR-185] Consistently evaluate skip parameter in MavenReport#canGenerateReport()
1 parent 0e94f5b commit 7cd3904

File tree

1 file changed

+22
-31
lines changed

1 file changed

+22
-31
lines changed

maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -377,40 +377,18 @@ protected ResourceBundle getBundle(Locale locale) {
377377
return ResourceBundle.getBundle("jxr-report", locale, this.getClass().getClassLoader());
378378
}
379379

380-
/**
381-
* Checks whether the report can be generated.
382-
*
383-
* @param sourceDirs list of source directories
384-
* @return true if the report could be generated
385-
*/
386-
protected boolean canGenerateReport(List<String> sourceDirs) {
387-
boolean canGenerate = !sourceDirs.isEmpty();
388-
389-
if (isAggregate() && !project.isExecutionRoot()) {
390-
canGenerate = false;
391-
}
392-
return canGenerate;
393-
}
394-
395380
@Override
396381
protected void executeReport(Locale locale) throws MavenReportException {
397-
if (skip) {
398-
getLog().info("Skipping JXR.");
399-
return;
400-
}
401-
List<String> sourceDirs = constructSourceDirs();
402-
if (canGenerateReport(sourceDirs)) {
403-
// init some attributes -- TODO (javadoc)
404-
init();
382+
// init some attributes -- TODO (javadoc)
383+
init();
405384

406-
// determine version of templates to use
407-
setJavadocTemplatesVersion();
385+
// determine version of templates to use
386+
setJavadocTemplatesVersion();
408387

409-
try {
410-
createXref(locale, getDestinationDirectory(), sourceDirs);
411-
} catch (JxrException | IOException e) {
412-
throw new MavenReportException("Error while generating the HTML source code of the project.", e);
413-
}
388+
try {
389+
createXref(locale, getDestinationDirectory(), constructSourceDirs());
390+
} catch (JxrException | IOException e) {
391+
throw new MavenReportException("Error while generating the HTML source code of the project.", e);
414392
}
415393
}
416394

@@ -471,7 +449,20 @@ protected List<String> constructSourceDirs() {
471449

472450
@Override
473451
public boolean canGenerateReport() {
474-
return canGenerateReport(constructSourceDirs());
452+
if (skip) {
453+
getLog().info("Skipping JXR.");
454+
return false;
455+
}
456+
457+
if (constructSourceDirs().isEmpty()) {
458+
return false;
459+
}
460+
461+
if (isAggregate() && !project.isExecutionRoot()) {
462+
return false;
463+
}
464+
465+
return true;
475466
}
476467

477468
@Override

0 commit comments

Comments
 (0)