Vampire
05/16/2024, 4:22 PMdependencies {
runtimeOnly("saxon:saxon:6.5.3")
implementation("net.sourceforge.nekohtml:nekohtml:1.9.22")
}
and do
System.out.println(SAXParserFactory.newInstance().newSAXParser());
You get Aelfred which is shipped with Saxon 6.
But if you do
dependencies {
constraints {
implementation("xerces:xercesImpl:2.12.2")
}
runtimeOnly("saxon:saxon:6.5.3")
implementation("net.sourceforge.nekohtml:nekohtml:1.9.22")
}
you "suddenly" get Xerces.
Actually using
val foo by tasks.registering {
doLast {
configurations.runtimeClasspath.get().forEach { println(it) }
}
}
to output the runtime classpath also shows that the order is not in declaration order anyway.
Without the constraint you first have neko, then saxon, then the neko dependency xerces, then the xerces dependency xml-apis.
With the constraint you first have neko, then xerces, then saxon, then xml-apis.Jendrik Johannes
05/17/2024, 7:39 AMdoFirst – which is still hacky but the best solution I know of. Have done that multiple times for test classpaths where getting things into the right order was the only solution.Vampire
05/17/2024, 10:14 AMbuildSrc dependencies. Setting system property in gradle.properties is also not possible as then the settings script fails as it also parses an XML file and there the built-in parser is used.
In the end I just moved the dependencies around so that the resulting order works as I need it in this case.Vampire
05/23/2024, 1:10 PM