Caleb Cushing
02/22/2025, 2:19 PM.create
same error)
val jbossLoggingConstraint = dependencies.constraints.create(libs.jboss.logging)
configurations.matching {
!setOf(
"archives",
"default",
).contains(it.name) && !it.name.contains("Elements") && !it.name.endsWith("Classpath")
}
.configureEach {
this.dependencyConstraints.add(jbossLoggingConstraint)
}
* Where:
Build file '/home/xeno/IdeaProjects/spring-app-commons/module/app-core/build.gradle.kts' line: 6
* What went wrong:
An exception occurred applying plugin request [id: 'our.javalibrary']
> Failed to apply plugin 'our.bom'.
> Cannot convert the provided notation to an object of type DependencyConstraint: map(valueof(DependencyValueSource)).
The following types/formats are supported:
- Instances of DependencyConstraint.
- String or CharSequence values, for example 'org.gradle:gradle-core:1.0'.
- Maps, for example [group: 'org.gradle', name: 'gradle-core', version: '1.0'].
- Projects, for example project(':some:project:path').
- Instances of ProjectDependency.
Comprehensive documentation on dependency notations is available in DSL reference for DependencyConstraintHandler type.
Sergej Koščejev
02/22/2025, 5:10 PMCaleb Cushing
02/22/2025, 5:12 PMCaleb Cushing
02/22/2025, 5:12 PMVampire
02/22/2025, 6:42 PMconfigurations.matching {
!setOf(
"archives",
"default",
).contains(it.name) && !it.name.contains("Elements") && !it.name.endsWith("Classpath")
}
.configureEach {
dependencies {
constraints {
this@configureEach(libs.jboss.logging)
}
}
}
?Caleb Cushing
02/23/2025, 4:59 PMCaleb Cushing
02/23/2025, 4:59 PM.matching {
!setOf(
"archives",
"default",
).contains(it.name) &&
!it.name.endsWith("Classpath") &&
!it.name.contains("Elements")
}
Vampire
02/23/2025, 5:09 PMmatching
or just use two ==
checks and an &&
instead.
Other than that, I don't know whether there is a better way, as I don't know what your goal is.
If your goal is, to match all configurations that are not named archives
, not named default
, not name ends with Classpath
, and not name contains Elements
, well, then that is your check.
I just don't see much logic in that condition, but if that is your use-case, ... 🙂Caleb Cushing
02/23/2025, 5:11 PMCaleb Cushing
02/23/2025, 5:11 PMCaleb Cushing
02/23/2025, 5:12 PMVampire
02/23/2025, 5:18 PMmatching
you create a new set for each and ever tested configuration.Caleb Cushing
02/23/2025, 5:19 PM