Exclude not available in java-platform constraints?

You could do

api ("org.apache.cactus:cactus.core.framework.uberjar.javaEE.15:1.8.1") {
   transitive = false
}