fix: decouple pmd, spotbugs, and checkstyle skip flags from skiptests - #1817
Open
aws-kevinrickard wants to merge 1 commit into
Open
fix: decouple pmd, spotbugs, and checkstyle skip flags from skiptests#1817aws-kevinrickard wants to merge 1 commit into
aws-kevinrickard wants to merge 1 commit into
Conversation
Each plugin's <skip> configuration was wired to the single ${skipTests}
property instead of its own idiomatic parameter. This meant passing a
plugin's documented skip flag (e.g. -Dspotbugs.skip=true) silently had
no effect, and -DskipTests=true skipped all static analysis in addition
to tests, conflating two different intents.
Each plugin now honors its own skip property, defaulting to false so
default behavior (mvn test with no flags) is unchanged:
- maven-pmd-plugin now reads pmd.skip
- spotbugs-maven-plugin now reads spotbugs.skip
- maven-checkstyle-plugin now reads checkstyle.skip
skipTests continues to control only test execution (surefire/jacoco),
as before.
alter-mage
approved these changes
Jul 24, 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.
Problem
maven-pmd-plugin,spotbugs-maven-plugin, andmaven-checkstyle-pluginall had their<configuration><skip>wired to the single${skipTests}property instead of their own idiomatic skip parameters. Concretely, inpom.xml:This causes two problems:
-Dspotbugs.skip=trueis the SpotBugs Maven plugin's own parameter, but since the POM never readsspotbugs.skip, passing it has zero effect — the analysis still runs. Same for-Dpmd.skip=trueand-Dcheckstyle.skip=true.-DskipTests=trueconflates two different intents: "skip running the test suite" and "skip static analysis." Passing it skips everything (tests + PMD + SpotBugs + Checkstyle), which is surprising if you only wanted to skip one of those.Fix
Each plugin now reads its own skip property, added to
<properties>with the same default (false)skipTestsalready had:And each plugin's
<configuration><skip>now points at its own property instead of${skipTests}.skipTestsis untouched everywhere else (surefire, JaCoCo) — it continues to control only test execution, as before.Behavior after this change
mvn test(no extra flags): identical to before — PMD, SpotBugs, Checkstyle, and the test suite all run, since the new properties default tofalsejust likeskipTestsdid.-Dpmd.skip=true: now actually skips PMD, while Checkstyle/SpotBugs/tests still run.-Dcheckstyle.skip=true: now actually skips Checkstyle, while PMD/SpotBugs/tests still run.-Dspotbugs.skip=true: now actually skips SpotBugs, while PMD/Checkstyle/tests still run.-DskipTests=true: still skips test execution (unchanged), but no longer skips PMD/Checkstyle/SpotBugs — each of those needs its own explicit flag now. This is the corrected, intended behavior: previously-DskipTests=trueskipped everything, which was itself the confusing overload this PR removes.Testing
Verified locally via full
mvn testlifecycle runs:-Dpmd.skip=true: PMD produces no report / does not run (confirmed via missingtarget/pmd.xmland near-instant mojo execution time vs. the multi-second scan when enabled); Checkstyle still runs.-Dcheckstyle.skip=true: Checkstyle mojo execution drops from ~4s to ~1s (confirming it no-ops) while PMD still runs and produces its report.-DskipTests=truealone: test execution is skipped (Tests are skipped.), while PMD and SpotBugs still execute in thetestphase as before.spotbugs-maven-plugin<version>, JaCoCo, or surefire configuration.Note: this environment's JDK (11/17/21) triggers a known, pre-existing, unrelated SpotBugs 4.0.0 crash (
Unsupported class file major version 61) when actually running the SpotBugs analysis — reproduced identically on unmodifiedmainbefore this change, so it isn't something introduced here.-Dspotbugs.skip=truewas used to work around it when verifying the other flags, and is itself one of the flags this PR fixes.