This is the current best way I'm aware of to do this in Gradle.
dependencies {
implementation(libs.jsieve.core)
constraints {
implementation("org.apache.james:apache-mime4j-core:[0.8.10,0.9)") {
because("CVE-2024-21742")
}
}