import enforcer.rules.BannedDependencies
import enforcer.rules.DependencyConvergence
import org.kordamp.gradle.plugin.enforcer.api.EnforcerLevel
plugins {
`java-library`
id("org.kordamp.gradle.project-enforcer")
}
group = "org.example"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
}
apply(plugin = "org.kordamp.gradle.project-enforcer")
enforce {
// can`t force to work
rule(DependencyConvergence::class.java) {
failOnDynamicVersions.set(true)
failOnChangingVersions.set(true)
failOnNonReproducibleResolution.set(true)
}
// works as expected
rule(BannedDependencies::class.java) {
enforcerLevel.set(EnforcerLevel.WARN)
exclude("org.slf4j:slf4j-api")
}
}
dependencies {
testImplementation(platform("org.junit:junit-bom:5.9.1"))
testImplementation("org.junit.jupiter:junit-jupiter")
implementation("org.slf4j:slf4j-jdk14:1.6.1")
implementation("org.slf4j:slf4j-nop:1.6.0")
}
tasks {
test {
useJUnitPlatform()
}
wrapper {
gradleVersion = "6.8.2"
}
}
Getting log for BannedDependencies rule:
`
Configure project :
[project-enforcer :] [AFTER_PROJECT :] An Enforcer rule has failed
org.kordamp.gradle.plugin.enforcer.api.EnforcerRuleException:
Enforcer rule 'enforcer.rules.BannedDependencies' was triggered.
Found Banned Dependency: org.slf4j:slf4j-api:1.6.1 in project :
Disable this rule temporarily with -Denforcer.rules.BannedDependencies.enabled=false and
invoke 'dependencies' to locate the source of the banned dependencies.
`
but if disable it and use only DependencyConvergence rule or both configuration not fails.
What Am I Doing Wrong? Can push minimal, reproducible Example if needed.
Hello! I have a problem with usage of DependencyConvergence rule.
settings.gradle.kts:
build.gradle.kts:
Getting log for BannedDependencies rule: `
but if disable it and use only DependencyConvergence rule or both configuration not fails.
What Am I Doing Wrong? Can push minimal, reproducible Example if needed.