You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "efegokdemir (via GitHub)" <gi...@apache.org> on 2026/09/25 17:53:45 UTC
[PR] fix: skip benchmark rendering without timing data [maven-pmd-plugin]
efegokdemir opened a new pull request, #747:
URL: https://github.com/apache/maven-pmd-plugin/pull/747
## Summary
When parallel Maven builds run PMD with benchmark output enabled, the global PMD timing tracker can return no timing report for a module. The benchmark renderer then dereferences the missing report and crashes the build.
## Changes
- Skip benchmark rendering when PMD produces no timing report.
- Add a regression test covering the missing-report path.
## Testing
- `mvn -q -Dspotless.check.skip=true -Dspotless.apply.skip=true -Dcheckstyle.skip -Drat.skip -Dtest=org.apache.maven.plugins.pmd.exec.PmdExecutorTest -Dsurefire.failIfNoSpecifiedTests=false test`
- `mvn -q -Dspotless.check.skip=true -Dspotless.apply.skip=true -Dcheckstyle.skip -Drat.skip -DskipITs verify`
- `git diff --check`
Fixes #656
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: skip benchmark rendering without timing data [maven-pmd-plugin]
Posted by "efegokdemir (via GitHub)" <gi...@apache.org>.
efegokdemir commented on PR #747:
URL: https://github.com/apache/maven-pmd-plugin/pull/747#issuecomment-5934389531
I traced the failure to PMD core TimeTracker using process-wide static state. Parallel Maven module executions could interleave start/stopGlobalTracking(), causing one execution to receive no report. This update serializes benchmark-enabled executions, removes the duplicate tracker start, and retains the null guard defensively. Validated with JDK 17: mvn spotless:apply, mvn spotless:check, and the focused PmdExecutorTest pass. Pushed as 87e9a14938d35852eef3997dc3e85547d8fec2a4; please re-review.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: skip benchmark rendering without timing data [maven-pmd-plugin]
Posted by "adangel (via GitHub)" <gi...@apache.org>.
adangel commented on code in PR #747:
URL: https://github.com/apache/maven-pmd-plugin/pull/747#discussion_r4154714949
##########
src/test/java/org/apache/maven/plugins/pmd/exec/PmdExecutorTest.java:
##########
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.plugins.pmd.exec;
+
+import java.lang.reflect.Method;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+
+class PmdExecutorTest {
+
+ @Test
+ void skipsBenchmarkReportWhenTimingReportIsMissing() throws Exception {
+ Path output = Files.createTempFile("pmd-benchmark", ".txt");
+ Files.delete(output);
+
+ Method writeBenchmarkReport = PmdExecutor.class.getDeclaredMethod(
+ "writeBenchmarkReport", net.sourceforge.pmd.benchmark.TimingReport.class, String.class, String.class);
Review Comment:
make the "writeBenchmarkReport" package-private, so that you can call it without reflection in the test (like #743).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: skip benchmark rendering without timing data [maven-pmd-plugin]
Posted by "efegokdemir (via GitHub)" <gi...@apache.org>.
efegokdemir commented on code in PR #747:
URL: https://github.com/apache/maven-pmd-plugin/pull/747#discussion_r4155010022
##########
src/test/java/org/apache/maven/plugins/pmd/exec/PmdExecutorTest.java:
##########
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.plugins.pmd.exec;
+
+import java.lang.reflect.Method;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+
+class PmdExecutorTest {
+
+ @Test
+ void skipsBenchmarkReportWhenTimingReportIsMissing() throws Exception {
+ Path output = Files.createTempFile("pmd-benchmark", ".txt");
+ Files.delete(output);
+
+ Method writeBenchmarkReport = PmdExecutor.class.getDeclaredMethod(
+ "writeBenchmarkReport", net.sourceforge.pmd.benchmark.TimingReport.class, String.class, String.class);
Review Comment:
Implemented in 95c0d0a: writeBenchmarkReport is package-private and the test now calls it directly without reflection. git diff --check passed; Maven was unavailable locally for the targeted test.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: skip benchmark rendering without timing data [maven-pmd-plugin]
Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo commented on code in PR #747:
URL: https://github.com/apache/maven-pmd-plugin/pull/747#discussion_r4241326614
##########
src/main/java/org/apache/maven/plugins/pmd/exec/PmdExecutor.java:
##########
@@ -270,7 +272,11 @@ private String getErrorsAsString(List<Report.ProcessingError> errors, boolean wi
return String.join(System.lineSeparator(), errorsAsString);
}
- private void writeBenchmarkReport(TimingReport timingReport, String benchmarkOutputLocation, String encoding) {
+ void writeBenchmarkReport(TimingReport timingReport, String benchmarkOutputLocation, String encoding) {
+ if (timingReport == null) {
+ LOG.warn("Skipping benchmark report because no timing report was produced.");
Review Comment:
This is not worthy of a warning, debug at most
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org