Skip to content

Commit 77c7c6c

Browse files
authored
[MPMD-411] Implement getOutputPath and identify getOutputName as deprecated, (#179)
1 parent 9e36e61 commit 77c7c6c

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,14 @@ private void executeCpd() throws MavenReportException {
210210
/**
211211
* {@inheritDoc}
212212
*/
213+
@Override
214+
@Deprecated
213215
public String getOutputName() {
214216
return "cpd";
215217
}
218+
219+
@Override
220+
public String getOutputPath() {
221+
return "cpd";
222+
}
216223
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,10 +543,16 @@ private String determineAuxClasspath() throws MavenReportException {
543543
* {@inheritDoc}
544544
*/
545545
@Override
546+
@Deprecated
546547
public String getOutputName() {
547548
return "pmd";
548549
}
549550

551+
@Override
552+
public String getOutputPath() {
553+
return "pmd";
554+
}
555+
550556
/**
551557
* Create and return the correct renderer for the output type.
552558
*

src/test/java/org/apache/maven/plugins/pmd/AbstractPmdReportTestCase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ protected File generateReport(AbstractPmdReport mojo, File pluginXmlFile) throws
141141
testMavenProject = builder.build(pluginXmlFile, buildingRequest).getProject();
142142

143143
File outputDir = mojo.getReportOutputDirectory();
144-
String filename = mojo.getOutputName() + ".html";
144+
String filename = mojo.getOutputPath() + ".html";
145145

146146
return new File(outputDir, filename);
147147
}

src/test/java/org/apache/maven/plugins/pmd/CpdReportTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,9 @@ public void testSkipEmptyReportConfiguration() throws Exception {
182182
public void testEmptyReportConfiguration() throws Exception {
183183
// verify the generated files do exist, even if there are no violations
184184
File generatedReport = generateReport(getGoal(), "empty-report/cpd-empty-report-plugin-config.xml");
185-
assertTrue(new File(generatedReport.getAbsolutePath()).exists());
185+
assertTrue(
186+
generatedReport.getAbsolutePath() + " does not exist",
187+
new File(generatedReport.getAbsolutePath()).exists());
186188

187189
String str = readFile(generatedReport);
188190
assertFalse(lowerCaseContains(str, "Hello.java"));

0 commit comments

Comments
 (0)