Skip to content

Commit ed944d5

Browse files
committed
[MPMD-379] Deprecate parameter "showPmdLog"
1 parent 00b9f13 commit ed944d5

File tree

5 files changed

+16
-23
lines changed

5 files changed

+16
-23
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,20 @@ public abstract class AbstractPmdReport extends AbstractMavenReport {
196196
* the PMD logger is also configured for debug.
197197
*
198198
* @since 3.9.0
199+
* @deprecated With 3.22.0 and the upgrade to PMD 7, this parameter has no effect anymore. The PMD log
200+
* is now always redirected into the maven log and this can't be disabled by this parameter anymore.
201+
* In order to disable the logging, see <a href="https://maven.apache.org/maven-logging.html">Maven Logging</a>.
202+
* You'd need to start maven with <code>MAVEN_OPTS=-Dorg.slf4j.simpleLogger.log.net.sourceforge.pmd=off mvn &lt;goals&gt;</code>.
199203
*/
200204
@Parameter(defaultValue = "true", property = "pmd.showPmdLog")
205+
@Deprecated(since = "3.22.0", forRemoval = true)
201206
protected boolean showPmdLog = true;
202207

208+
/**
209+
* Used to avoid showing the deprecation warning for "showPmdLog" multiple times.
210+
*/
211+
private boolean warnedAboutShowPmdLog = false;
212+
203213
/**
204214
* <p>
205215
* Allow for configuration of the jvm used to run PMD via maven toolchains.
@@ -454,6 +464,12 @@ protected boolean isXml() {
454464
*/
455465
@Override
456466
public boolean canGenerateReport() {
467+
if (!showPmdLog && !warnedAboutShowPmdLog) {
468+
getLog().warn("The parameter \"showPmdLog\" has been deprecated and will be removed."
469+
+ "Setting it to \"false\" has no effect.");
470+
warnedAboutShowPmdLog = true;
471+
}
472+
457473
if (aggregate && !project.isExecutionRoot()) {
458474
return false;
459475
}

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,7 @@ private void executeCpd() throws MavenReportException {
185185
request.setIgnoreLiterals(ignoreLiterals);
186186
request.setSourceEncoding(getInputEncoding());
187187
request.addFiles(filesToProcess.keySet());
188-
189-
request.setShowPmdLog(showPmdLog);
190188
request.setLogLevel(determineCurrentRootLogLevel());
191-
192189
request.setExcludeFromFailureFile(excludeFromFailureFile);
193190
request.setTargetDirectory(targetDirectory.getAbsolutePath());
194191
request.setOutputEncoding(getOutputEncoding());

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,11 +366,9 @@ private void executePmd() throws MavenReportException {
366366
request.setBenchmarkOutputLocation(benchmark ? benchmarkOutputFilename : null);
367367
request.setAnalysisCacheLocation(analysisCache ? analysisCacheLocation : null);
368368
request.setExcludeFromFailureFile(excludeFromFailureFile);
369-
370369
request.setTargetDirectory(targetDirectory.getAbsolutePath());
371370
request.setOutputEncoding(getOutputEncoding());
372371
request.setFormat(format);
373-
request.setShowPmdLog(showPmdLog);
374372
request.setSkipPmdError(skipPmdError);
375373
request.setIncludeXmlInSite(includeXmlInSite);
376374
request.setReportOutputDirectory(getReportOutputDirectory().getAbsolutePath());

src/main/java/org/apache/maven/plugins/pmd/exec/CpdRequest.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ public class CpdRequest implements Serializable {
4444
private String sourceEncoding;
4545
private List<File> files = new ArrayList<>();
4646

47-
private boolean showPmdLog;
4847
private String logLevel;
4948

5049
private String excludeFromFailureFile;
@@ -105,10 +104,6 @@ public void setReportOutputDirectory(String reportOutputDirectory) {
105104
this.reportOutputDirectory = reportOutputDirectory;
106105
}
107106

108-
public void setShowPmdLog(boolean showPmdLog) {
109-
this.showPmdLog = showPmdLog;
110-
}
111-
112107
public void setLogLevel(String logLevel) {
113108
this.logLevel = logLevel;
114109
}
@@ -161,10 +156,6 @@ public String getReportOutputDirectory() {
161156
return reportOutputDirectory;
162157
}
163158

164-
public boolean isShowPmdLog() {
165-
return showPmdLog;
166-
}
167-
168159
public String getLogLevel() {
169160
return logLevel;
170161
}

src/main/java/org/apache/maven/plugins/pmd/exec/PmdRequest.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ public class PmdRequest implements Serializable {
4747
private String sourceEncoding;
4848
private List<File> files = new ArrayList<>();
4949

50-
private boolean showPmdLog;
5150
private String logLevel;
5251
private boolean skipPmdError;
5352

@@ -126,10 +125,6 @@ public void setFormat(String format) {
126125
this.format = format;
127126
}
128127

129-
public void setShowPmdLog(boolean showPmdLog) {
130-
this.showPmdLog = showPmdLog;
131-
}
132-
133128
public void setLogLevel(String logLevel) {
134129
this.logLevel = logLevel;
135130
}
@@ -206,10 +201,6 @@ public String getFormat() {
206201
return format;
207202
}
208203

209-
public boolean isShowPmdLog() {
210-
return showPmdLog;
211-
}
212-
213204
public String getLogLevel() {
214205
return logLevel;
215206
}

0 commit comments

Comments
 (0)