Skip to content

Bump PMD to 7.28.0 and improve auxclasspath handling - #330

Merged
jborgers merged 6 commits into
amitdev:masterfrom
stokpop:pmd-7.28.0
Oct 8, 2026
Merged

jborgers merged 6 commits into
amitdev:masterfrom
stokpop:pmd-7.28.0

Conversation

@stokpop

@stokpop stokpop commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Bump PMD from 7.21.0 to 7.28.0
  • Adapt the auxclasspath to the new PMD 7.27+ behaviour
  • Add a runIdeLatest Gradle task to run the plugin in IntelliJ IDEA 2026.2.3

Auxclasspath changes

Since PMD 7.27, the Java module resolves classes only from the auxclasspath
(AuxClasspathLoader), without falling back to the plugin classloader. If no
jrt-fs.jar is 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 prependAuxClasspath throw. This resulted in lots of
warnings and unresolved types.

This PR:

The logic is in a new AuxClasspath class (only depends on IntelliJ's Logger),
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 #307
instead 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 pass
  • Manual test in runIde: plugin works with PMD 7.28.0
  • idea.log: no auxclasspath warnings

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
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
jborgers self-requested a review October 8, 2026 16:13

@jborgers jborgers left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, no comments

@jborgers
jborgers merged commit ab952cb into amitdev:master Oct 8, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants