Add NoSystemScopeDependencies cleanup recipe#7055
Merged
jkschneider merged 7 commits intomainfrom Mar 22, 2026
Merged
Conversation
…pendencies This recipe removes <scope>system</scope> and <systemPath> from Maven dependencies when the artifact is available in configured repositories. System scope is deprecated, non-portable, and problematic because it requires a machine-specific systemPath and is not packaged in artifacts. The recipe only removes system scope if the dependency can be verified to exist in a configured Maven repository by checking available versions. Dependencies not found in any repository are left unchanged. Fixes Sonar finding: 'Dependencies should not have "system" scope'
Include the new recipe in the BestPractices composite recipe and add its entry to recipes.csv.
timtebeek
commented
Mar 19, 2026
Comment on lines
+34
to
+35
| final String description = "Replaces `<scope>system</scope>` with the default compile scope and removes " + | ||
| "`<systemPath>` for dependencies that are available in configured repositories."; |
Member
Author
There was a problem hiding this comment.
So we know this isn't a complete solution for all cases, but it allows folks to push that jar somewhere and then from there see the system scope dropped here.
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
Adds a new cleanup recipe
NoSystemScopeDependenciesthat fixes Sonar rule S3422 by removing system-scoped Maven dependencies when they are available in configured repositories.System scope is problematic because it requires a machine-specific
<systemPath>, is non-portable, and cannot be packaged in artifacts. The recipe verifies artifact availability before removing the scope, leaving truly local-only dependencies unchanged.Changes
NoSystemScopeDependencies.java<scope>system</scope>and<systemPath>if the dependency version exists in configured repositories<dependencies>and<dependencyManagement>sectionsTest Plan
NoSystemScopeDependenciesTestpass