This message was deleted.
# community-support
s
This message was deleted.
c
Like if you're writing a convention plugin that sets useJunitPlatform, and a sub-project pulls in junit4
That our 'substitution system' would add junit vintage
Currently, using the regular dependency substitution system kinda breaks junit4
Copy code
\--- junit:junit:4.13.2 -> org.junit.vintage:junit-vintage-engine:5.8.2
     +--- org.junit:junit-bom:5.8.2
     |    +--- org.junit.platform:junit-platform-engine:1.8.2 (c)
     |    +--- org.junit.vintage:junit-vintage-engine:5.8.2 (c)
     |    \--- org.junit.platform:junit-platform-commons:1.8.2 (c)
     +--- org.junit.platform:junit-platform-engine:1.8.2
     |    +--- org.junit:junit-bom:5.8.2 (*)
     |    +--- org.opentest4j:opentest4j:1.2.0
     |    \--- org.junit.platform:junit-platform-commons:1.8.2
     |         \--- org.junit:junit-bom:5.8.2 (*)
     \--- junit:junit:4.13.2 -> org.junit.vintage:junit-vintage-engine:5.8.2 (*)
when using
Copy code
configurations.all {
    resolutionStrategy.dependencySubstitution {
        substitute module("junit:junit") using module("org.junit.vintage:junit-vintage-engine:5.8.2")
    }
}
Came up with one solution, but I'm not sure if its the best idea
Copy code
@CacheableRule
abstract class Junit4DependenciesRule: ComponentMetadataRule {
    override fun execute(context: ComponentMetadataContext) {
        context.details.allVariants {
            withDependencies {
                add("org.junit.vintage:junit-vintage-engine:5.8.2")
            }
        }
    }
}

dependencies {
    components {
        withModule<Junit4DependenciesRule>("junit:junit")
    }
}