diff --git a/src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java b/src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java index 0193c549..ad25d6d5 100644 --- a/src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java +++ b/src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java @@ -42,8 +42,6 @@ import org.apache.maven.model.Dependency; import org.apache.maven.model.Plugin; import org.apache.maven.model.PluginManagement; -import org.apache.maven.model.ReportPlugin; -import org.apache.maven.model.Reporting; import org.apache.maven.model.Resource; import org.apache.maven.plugin.descriptor.PluginDescriptor; import org.apache.maven.plugins.annotations.Component; @@ -489,45 +487,6 @@ protected List getReactorProjects() { return reactorProjects; } - protected String constructXrefLocation(boolean test, boolean haveResults) { - String location = null; - if (linkXRef) { - File xrefLocation = getXrefLocation(test); - - String relativePath = PathTool.getRelativePath( - getReportOutputDirectory().getAbsolutePath(), xrefLocation.getAbsolutePath()); - if (relativePath == null || relativePath.isEmpty()) { - relativePath = "."; - } - relativePath = relativePath + "/" + xrefLocation.getName(); - if (xrefLocation.exists()) { - // XRef was already generated by manual execution of a lifecycle binding - location = relativePath; - } else { - // Not yet generated - check if the report is on its way - Reporting reporting = project.getModel().getReporting(); - List reportPlugins = - reporting != null ? reporting.getPlugins() : Collections.emptyList(); - for (ReportPlugin plugin : reportPlugins) { - String artifactId = plugin.getArtifactId(); - if ("maven-jxr-plugin".equals(artifactId) || "jxr-maven-plugin".equals(artifactId)) { - location = relativePath; - } - } - } - - if (location == null && haveResults) { - getLog().warn("Unable to locate" + (test ? " Test" : "") + " Source XRef to link to - DISABLED"); - } - } - return location; - } - - protected File getXrefLocation(boolean test) { - File location = test ? xrefTestLocation : xrefLocation; - return location != null ? location : new File(getReportOutputDirectory(), test ? "xref-test" : "xref"); - } - /** {@inheritDoc} */ public void executeReport(Locale locale) throws MavenReportException { checkDeprecatedParameterUsage(sourceDirectory, "sourceDirectory", "sourceDirectories"); @@ -573,7 +532,6 @@ public void executeReport(Locale locale) throws MavenReportException { CheckstyleResults results = checkstyleExecutor.executeCheckstyle(request); - boolean haveResults = results.getFileCount() > 0; CheckstyleReportRenderer r = new CheckstyleReportRenderer( getSink(), i18n, @@ -581,8 +539,8 @@ public void executeReport(Locale locale) throws MavenReportException { project, siteTool, effectiveConfigLocation, - constructXrefLocation(false, haveResults), - constructXrefLocation(true, haveResults), + linkXRef ? constructXrefLocation(xrefLocation, false) : null, + linkXRef ? constructXrefLocation(xrefTestLocation, true) : null, linkXRef ? getTestSourceDirectories() : Collections.emptyList(), enableRulesSummary, enableSeveritySummary,