https://jakewharton.com/nonsensical-maven-is-still-a-gradle-problem/
plugins {
id("io.github.usefulness.maven-sympathy") version "{{version}}"
}Version Catalog
usefulness-maven-sympathy = { id = "io.github.usefulness.maven-sympathy", version = "{{version}}" }From now on, the sympathyForMrMaven will run on every check task invocation.
[compileClasspath] dependency org.jetbrains.kotlin:kotlin-stdlib:1.9.22 version changed: 1.9.22 → 1.9.23
[runtimeClasspath] dependency org.jetbrains.kotlin:kotlin-stdlib:1.9.22 version changed: 1.9.22 → 1.9.23
> Task :sympathyForMrMaven FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':sympathyForMrMaven'.
> Declared dependencies were upgraded transitively. See task output above. Please update their versions.
Configurable via io.github.usefulness.mavensympathy.MavenSympathyExtension extension.
Groovy
mavenSympathy {
attachStrategy = io.github.usefulness.mavensympathy.AttachStrategy.Default
}Kotlin
mavenSympathy {
attachStrategy = io.github.usefulness.mavensympathy.AttachStrategy.Default
}attachStrategy- Defines how the plugin will hook up with the project to listen for version mismatches. Has to be one of:WatchAllResolvableConfigurations- the plugin will check all resolvable configurations for versions mismatchExtractFromMavenPublishComponents- the plugin will only watch configurations attached to SoftwareComponents
The implementation relies on internal gradle APIs and may break in the future Gradle versions.Default- ifmaven-publishis present, the plugin will behave asExtractFromMavenPublishComponents, if not it will fall back toWatchAllResolvableConfigurationsbehavior.
The behavior is subject to change, but the assumption is it should cover most common setups.
Groovy
tasks.named("sympathyForMrMaven") {
behaviorOnMismatch = BehaviorOnMismatch.Fail
}Kotlin
tasks.named<io.github.usefulness.mavensympathy.SympathyForMrMavenTask>("sympathyForMrMaven") {
behaviorOnMismatch = BehaviorOnMismatch.Fail
}behaviorOnMismatch - one of Fail (prints error logs + fails the build) or Warn (only prints error logs)