waterWang opened a new pull request, #1002:
URL: https://github.com/apache/maven-enforcer/pull/1002

   ### Summary
   
   Fixes #998.
   
   The `RequireUpperBoundDeps` rule documentation states that the `includes` 
parameter accepts `groupId[:artifactId]` format (with `artifactId` being 
optional), but the implementation only supported exact string matching via 
`List.contains()`. This meant specifying just a `groupId` (e.g., `com.example`) 
would not match dependencies like `com.example:my-lib`.
   
   ### Changes
   
   - Changed `RequireUpperBoundDepsVisitor.includes` from `List<String>` to 
`Predicate<Artifact> includesMatcher`
   - Used `ArtifactUtils.prepareDependencyArtifactMatcher()` to create the 
predicate — the same approach used by `BannedDependencies`, 
`RequireReleaseDeps`, and other rules that already support 
`groupId[:artifactId]` format
   - Updated `visitEnter()` to use the predicate instead of direct string 
comparison
   
   ### Tests
   
   - Added `testIncludesWithGroupIdOnly()` — verifies that `includes = 
["default-group"]` correctly detects conflicts for dependencies with that 
groupId
   - Added `testIncludesWithGroupIdOnlyExcludesOtherGroup()` — verifies that 
`includes = ["other-group"]` correctly ignores dependencies with a different 
groupId
   - All 3 tests pass (1 existing + 2 new)


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to