|
42 | 42 | import org.apache.maven.model.Dependency; |
43 | 43 | import org.apache.maven.model.Plugin; |
44 | 44 | import org.apache.maven.model.PluginManagement; |
45 | | -import org.apache.maven.model.ReportPlugin; |
46 | | -import org.apache.maven.model.Reporting; |
47 | 45 | import org.apache.maven.model.Resource; |
48 | 46 | import org.apache.maven.plugin.descriptor.PluginDescriptor; |
49 | 47 | import org.apache.maven.plugins.annotations.Component; |
@@ -489,45 +487,6 @@ protected List<MavenProject> getReactorProjects() { |
489 | 487 | return reactorProjects; |
490 | 488 | } |
491 | 489 |
|
492 | | - protected String constructXrefLocation(boolean test, boolean haveResults) { |
493 | | - String location = null; |
494 | | - if (linkXRef) { |
495 | | - File xrefLocation = getXrefLocation(test); |
496 | | - |
497 | | - String relativePath = PathTool.getRelativePath( |
498 | | - getReportOutputDirectory().getAbsolutePath(), xrefLocation.getAbsolutePath()); |
499 | | - if (relativePath == null || relativePath.isEmpty()) { |
500 | | - relativePath = "."; |
501 | | - } |
502 | | - relativePath = relativePath + "/" + xrefLocation.getName(); |
503 | | - if (xrefLocation.exists()) { |
504 | | - // XRef was already generated by manual execution of a lifecycle binding |
505 | | - location = relativePath; |
506 | | - } else { |
507 | | - // Not yet generated - check if the report is on its way |
508 | | - Reporting reporting = project.getModel().getReporting(); |
509 | | - List<ReportPlugin> reportPlugins = |
510 | | - reporting != null ? reporting.getPlugins() : Collections.<ReportPlugin>emptyList(); |
511 | | - for (ReportPlugin plugin : reportPlugins) { |
512 | | - String artifactId = plugin.getArtifactId(); |
513 | | - if ("maven-jxr-plugin".equals(artifactId) || "jxr-maven-plugin".equals(artifactId)) { |
514 | | - location = relativePath; |
515 | | - } |
516 | | - } |
517 | | - } |
518 | | - |
519 | | - if (location == null && haveResults) { |
520 | | - getLog().warn("Unable to locate" + (test ? " Test" : "") + " Source XRef to link to - DISABLED"); |
521 | | - } |
522 | | - } |
523 | | - return location; |
524 | | - } |
525 | | - |
526 | | - protected File getXrefLocation(boolean test) { |
527 | | - File location = test ? xrefTestLocation : xrefLocation; |
528 | | - return location != null ? location : new File(getReportOutputDirectory(), test ? "xref-test" : "xref"); |
529 | | - } |
530 | | - |
531 | 490 | /** {@inheritDoc} */ |
532 | 491 | public void executeReport(Locale locale) throws MavenReportException { |
533 | 492 | checkDeprecatedParameterUsage(sourceDirectory, "sourceDirectory", "sourceDirectories"); |
@@ -573,16 +532,15 @@ public void executeReport(Locale locale) throws MavenReportException { |
573 | 532 |
|
574 | 533 | CheckstyleResults results = checkstyleExecutor.executeCheckstyle(request); |
575 | 534 |
|
576 | | - boolean haveResults = results.getFileCount() > 0; |
577 | 535 | CheckstyleReportRenderer r = new CheckstyleReportRenderer( |
578 | 536 | getSink(), |
579 | 537 | i18n, |
580 | 538 | locale, |
581 | 539 | project, |
582 | 540 | siteTool, |
583 | 541 | effectiveConfigLocation, |
584 | | - constructXrefLocation(false, haveResults), |
585 | | - constructXrefLocation(true, haveResults), |
| 542 | + linkXRef ? constructXrefLocation(xrefLocation, false) : null, |
| 543 | + linkXRef ? constructXrefLocation(xrefTestLocation, true) : null, |
586 | 544 | linkXRef ? getTestSourceDirectories() : Collections.emptyList(), |
587 | 545 | enableRulesSummary, |
588 | 546 | enableSeveritySummary, |
|
0 commit comments