Skip to content

Commit e99d2e4

Browse files
committed
[MPMD-407] Upgrade to Doxia 2.0.0 GA Stack
This closes #175
1 parent c57895e commit e99d2e4

File tree

2 files changed

+9
-51
lines changed

2 files changed

+9
-51
lines changed

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ under the License.
8686
<pmdVersion>7.3.0</pmdVersion>
8787
<slf4jVersion>1.7.36</slf4jVersion>
8888
<resolverVersion>1.4.1</resolverVersion>
89-
<doxiaVersion>2.0.0-M12</doxiaVersion>
89+
<doxiaVersion>2.0.0</doxiaVersion>
9090
<compilerPluginVersion>3.11.0</compilerPluginVersion>
9191
<sitePluginVersion>3.20.0</sitePluginVersion>
9292
<projectInfoReportsPluginVersion>3.7.0</projectInfoReportsPluginVersion>
93-
<jxrPluginVersion>3.4.0</jxrPluginVersion>
93+
<jxrPluginVersion>3.5.0</jxrPluginVersion>
9494
<project.build.outputTimestamp>2024-08-22T16:42:52Z</project.build.outputTimestamp>
9595
</properties>
9696

@@ -212,7 +212,7 @@ under the License.
212212
<dependency>
213213
<groupId>org.apache.maven.reporting</groupId>
214214
<artifactId>maven-reporting-impl</artifactId>
215-
<version>4.0.0-M15</version>
215+
<version>4.0.0</version>
216216
</dependency>
217217

218218
<!-- plexus -->

src/main/java/org/apache/maven/plugins/pmd/AbstractPmdReport.java

Lines changed: 6 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@
3737

3838
import net.sourceforge.pmd.PMDVersion;
3939
import org.apache.maven.execution.MavenSession;
40-
import org.apache.maven.model.ReportPlugin;
41-
import org.apache.maven.model.Reporting;
4240
import org.apache.maven.plugin.MojoExecution;
4341
import org.apache.maven.plugins.annotations.Component;
4442
import org.apache.maven.plugins.annotations.Parameter;
@@ -48,7 +46,6 @@
4846
import org.apache.maven.toolchain.Toolchain;
4947
import org.apache.maven.toolchain.ToolchainManager;
5048
import org.codehaus.plexus.util.FileUtils;
51-
import org.codehaus.plexus.util.PathTool;
5249
import org.codehaus.plexus.util.StringUtils;
5350

5451
/**
@@ -283,45 +280,6 @@ protected MojoExecution getMojoExecution() {
283280
return mojoExecution;
284281
}
285282

286-
protected String constructXrefLocation(boolean test) {
287-
String location = null;
288-
if (linkXRef) {
289-
File xrefLocation = getXrefLocation(test);
290-
291-
String relativePath = PathTool.getRelativePath(
292-
getReportOutputDirectory().getAbsolutePath(), xrefLocation.getAbsolutePath());
293-
if (relativePath == null || relativePath.isEmpty()) {
294-
relativePath = ".";
295-
}
296-
relativePath = relativePath + "/" + xrefLocation.getName();
297-
if (xrefLocation.exists()) {
298-
// XRef was already generated by manual execution of a lifecycle binding
299-
location = relativePath;
300-
} else {
301-
// Not yet generated - check if the report is on its way
302-
Reporting reporting = project.getModel().getReporting();
303-
List<ReportPlugin> reportPlugins =
304-
reporting != null ? reporting.getPlugins() : Collections.<ReportPlugin>emptyList();
305-
for (ReportPlugin plugin : reportPlugins) {
306-
String artifactId = plugin.getArtifactId();
307-
if ("maven-jxr-plugin".equals(artifactId)) {
308-
location = relativePath;
309-
}
310-
}
311-
}
312-
313-
if (location == null) {
314-
getLog().warn("Unable to locate" + (test ? " Test" : "") + " Source XRef to link to - DISABLED");
315-
}
316-
}
317-
return location;
318-
}
319-
320-
protected File getXrefLocation(boolean test) {
321-
File location = test ? xrefTestLocation : xrefLocation;
322-
return location != null ? location : new File(getReportOutputDirectory(), test ? "xref-test" : "xref");
323-
}
324-
325283
/**
326284
* Convenience method to get the list of files where the PMD tool will be executed
327285
*
@@ -355,7 +313,7 @@ protected Map<File, PmdFileInfo> getFilesToProcess() throws IOException {
355313
for (String root : compileSourceRoots) {
356314
File sroot = new File(root);
357315
if (sroot.exists()) {
358-
String sourceXref = constructXrefLocation(false);
316+
String sourceXref = linkXRef ? constructXrefLocation(xrefLocation, false) : null;
359317
directories.add(new PmdFileInfo(project, sroot, sourceXref));
360318
}
361319
}
@@ -368,8 +326,8 @@ protected Map<File, PmdFileInfo> getFilesToProcess() throws IOException {
368326
for (String root : testSourceRoots) {
369327
File sroot = new File(root);
370328
if (sroot.exists()) {
371-
String testXref = constructXrefLocation(true);
372-
directories.add(new PmdFileInfo(project, sroot, testXref));
329+
String testSourceXref = linkXRef ? constructXrefLocation(xrefTestLocation, true) : null;
330+
directories.add(new PmdFileInfo(project, sroot, testSourceXref));
373331
}
374332
}
375333
}
@@ -379,7 +337,7 @@ protected Map<File, PmdFileInfo> getFilesToProcess() throws IOException {
379337
for (String root : localCompileSourceRoots) {
380338
File sroot = new File(root);
381339
if (sroot.exists()) {
382-
String sourceXref = constructXrefLocation(false);
340+
String sourceXref = linkXRef ? constructXrefLocation(xrefLocation, false) : null;
383341
directories.add(new PmdFileInfo(localProject, sroot, sourceXref));
384342
}
385343
}
@@ -388,8 +346,8 @@ protected Map<File, PmdFileInfo> getFilesToProcess() throws IOException {
388346
for (String root : localTestCompileSourceRoots) {
389347
File sroot = new File(root);
390348
if (sroot.exists()) {
391-
String testXref = constructXrefLocation(true);
392-
directories.add(new PmdFileInfo(localProject, sroot, testXref));
349+
String testSourceXref = linkXRef ? constructXrefLocation(xrefTestLocation, true) : null;
350+
directories.add(new PmdFileInfo(localProject, sroot, testSourceXref));
393351
}
394352
}
395353
}

0 commit comments

Comments
 (0)