Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-o committed Oct 20, 2024
1 parent 6ac89b8 commit 9ccb06e
Showing 1 changed file with 2 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -489,45 +487,6 @@ protected List<MavenProject> 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<ReportPlugin> reportPlugins =
reporting != null ? reporting.getPlugins() : Collections.<ReportPlugin>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");
Expand Down Expand Up @@ -573,16 +532,15 @@ public void executeReport(Locale locale) throws MavenReportException {

CheckstyleResults results = checkstyleExecutor.executeCheckstyle(request);

boolean haveResults = results.getFileCount() > 0;
CheckstyleReportRenderer r = new CheckstyleReportRenderer(
getSink(),
i18n,
locale,
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,
Expand Down

0 comments on commit 9ccb06e

Please sign in to comment.