Skip to content

Commit 9ccb06e

Browse files
committed
fix
1 parent 6ac89b8 commit 9ccb06e

File tree

1 file changed

+2
-44
lines changed

1 file changed

+2
-44
lines changed

src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java

+2-44
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@
4242
import org.apache.maven.model.Dependency;
4343
import org.apache.maven.model.Plugin;
4444
import org.apache.maven.model.PluginManagement;
45-
import org.apache.maven.model.ReportPlugin;
46-
import org.apache.maven.model.Reporting;
4745
import org.apache.maven.model.Resource;
4846
import org.apache.maven.plugin.descriptor.PluginDescriptor;
4947
import org.apache.maven.plugins.annotations.Component;
@@ -489,45 +487,6 @@ protected List<MavenProject> getReactorProjects() {
489487
return reactorProjects;
490488
}
491489

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-
531490
/** {@inheritDoc} */
532491
public void executeReport(Locale locale) throws MavenReportException {
533492
checkDeprecatedParameterUsage(sourceDirectory, "sourceDirectory", "sourceDirectories");
@@ -573,16 +532,15 @@ public void executeReport(Locale locale) throws MavenReportException {
573532

574533
CheckstyleResults results = checkstyleExecutor.executeCheckstyle(request);
575534

576-
boolean haveResults = results.getFileCount() > 0;
577535
CheckstyleReportRenderer r = new CheckstyleReportRenderer(
578536
getSink(),
579537
i18n,
580538
locale,
581539
project,
582540
siteTool,
583541
effectiveConfigLocation,
584-
constructXrefLocation(false, haveResults),
585-
constructXrefLocation(true, haveResults),
542+
linkXRef ? constructXrefLocation(xrefLocation, false) : null,
543+
linkXRef ? constructXrefLocation(xrefTestLocation, true) : null,
586544
linkXRef ? getTestSourceDirectories() : Collections.emptyList(),
587545
enableRulesSummary,
588546
enableSeveritySummary,

0 commit comments

Comments
 (0)