Dependency include/exclude pattern doesn't support empty string in module name
bug
### Expected and Results
### Shadow Version
9.3.1
### Gradle Version
8.14.3
### Expected Behavior
```
dependencies {
exclude(dependency("io.grpc::.*"))
```
should exclude all packages group match io.grpc but match nothing
### Workaround
```
dependencies {
exclude(dependency("io.grpc:.*:.*")) <== add match all pattern in module name
```
### Description
I check the old source groovy source
https://github.com/GradleUp/shadow/blob/8.3.9/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/internal/AbstractDependencyFilter.groovy#L107
```
@Override
Spec<? super ResolvedDependency> dependency(Dependency dependency) {
this.dependency({ ResolvedDependency it ->
(!dependency.group || it.moduleGroup.matches(dependency.group)) &&
(!dependency.name || it.moduleName.matches(dependency.name)) &&
(!dependency.version || it.moduleVersion.matches(dependency.version))
})
}
```
when group,name,version is empty, then it should match
but new behavior
https://github.com/GradleUp/shadow/blob/9.3.1/src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/tasks/DependencyFilter.kt#L105
empty string won't match module name
### Related environment and versions
_No response_
### Reproduction steps
_No response_
### Anything else?
_No response_
关闭于 2026-01-08 3 条评论