Repository navigation
Bump PMD to 7.28.0 and improve auxclasspath handling - #330
Merged
Merged
Conversation
Since PMD 7.27 classes are resolved only from the auxclasspath, without falling back to the plugin classloader, and missing entries cause warnings (or an exception for a missing jar). - Add the project SDK's jrt-fs.jar (or rt.jar for Java 8) instead of passing IntelliJ's JDK module roots, so PMD resolves the project JDK and not the IDE runtime - Skip not existing and empty classpath entries - Delete the PMD analysis cache when class files in output directories change, as PMD does not fingerprint directory contents - Add unit tests
PMD's analysis cache fingerprints all jars on the auxclasspath and fails with a ZipException on an invalid archive, which aborts the whole analysis (amitdev#322). Skip such jars with a warning. The check is cached per jar on last modified time and size.
stokpop
marked this pull request as ready for review
October 7, 2026 15:32
2.1.0 was released without merging the changelog patch (amitdev#307), so the 2.1.0 entries were still listed as unreleased. Apply that patch here, identical to amitdev#307, so both can be merged in any order.
jborgers
self-requested a review
October 8, 2026 16:13
jborgers
approved these changes
Oct 8, 2026
jborgers
left a comment
Collaborator
There was a problem hiding this comment.
Looking good, no comments
This was referenced Oct 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
runIdeLatestGradle task to run the plugin in IntelliJ IDEA 2026.2.3Auxclasspath changes
Since PMD 7.27, the Java module resolves classes only from the auxclasspath
(
AuxClasspathLoader), without falling back to the plugin classloader. If nojrt-fs.jaris on the auxclasspath, PMD falls back to the current runtime(the IDE's JBR) and logs a warning. Missing entries cause warnings, and a
missing jar even makes
prependAuxClasspaththrow. This resulted in lots ofwarnings and unresolved types.
This PR:
jrt-fs.jar(orrt.jarfor Java 8) of the project SDK instead ofIntelliJ's JDK module roots, so PMD resolves the project's JDK and not the
IDE runtime
target/classesbefore the first build)
PMD does not fingerprint directory contents, so without this, results from a
run before a build stayed cached for unchanged files.
all jars and aborts the whole analysis on a
ZipException(Incremental analysis can't fingerprint classpath contents #322). This stillhappens with PMD 7.28.0. Fixed upstream in PMD 7.29.0 ([core] Fix #7156: Analysis cache fails with ZipException on invalid archive pmd/pmd#7157, issue [core] Analysis cache fails with ZipException on invalid archive on the auxclasspath pmd/pmd#7156),
this workaround can be removed after upgrading.
The logic is in a new
AuxClasspathclass (only depends on IntelliJ'sLogger),covered by unit tests (also the first tests in
src/test).The changelog includes the v2.1.0 changelog patch of #307 (2.1.0 was released without it),
the new changes are in a new
[Unreleased]section. This supersedes #307: please close #307instead of merging it, merging both results in a duplicate
[2.1.0]section.Related: #52, #322, and pmd/pmd#6224 (results depend on the JDK version used for analysis).
Testing
./gradlew build, 23 new unit tests passrunIde: plugin works with PMD 7.28.0