This borders on a “frequently asked question” and I think I’ve read all of the recent posts about it. I am still floundering, so I’m going to see if someone will point me to the answer…
I created a simple little demo project with this build.gradle.kts
:
plugins {
id("java")
}
repositories {
mavenLocal()
mavenCentral()
}
val demopath by configurations.creating {
extendsFrom(configurations["implementation"])
}
configurations.configureEach {
exclude("net.sf.saxon:Saxon-HE")
exclude("com.saxonica:Saxon-EE")
}
dependencies {
implementation("org.nineml:coffeegrinder:3.2.6")
implementation("org.nineml:coffeefilter:3.2.6")
}
tasks.register("helloWorld") {
doLast {
demopath.forEach { file ->
println(file)
}
}
}
If you run the helloWorld
task, it will tell you that Saxon-HE:9.6.0.4
is in the demopath
. This is a transitive dependency of CoffeeFilter.
I don’t want that on the classpath. Based on some posts I’ve read, I expected this to exclude it:
implementation("org.nineml:coffeegrinder:3.2.6") {
exclude("net.sf.saxon:Saxon-HE")
exclude("com.saxonica:Saxon-EE")
}
implementation("org.nineml:coffeefilter:3.2.6") {
exclude("net.sf.saxon:Saxon-HE")
exclude("com.saxonica:Saxon-EE")
}
But it didn’t. Based on other posts, I expected this to exclude it:
configurations.configureEach {
exclude("net.sf.saxon:Saxon-HE")
exclude("com.saxonica:Saxon-EE")
}
It also did not.
I am, in fact, working on the build script for Saxon-HE. I don’t want Saxon-HE included by any transitive dependency from any dependency, transitive or otherwise!
I assume I’m overlooking something obvious, but, uh, I’m overlooking it
Help?