spring-projects/spring-boot

spring-boot-mail should depend on jakarta.mail:jakarta.mail-api and org.eclipse.angus:angus-mail instead of org.eclipse.angus:jakarta.mail

Closed this issue · 3 comments

spring-boot-starter-mail (at least for 3.5.6 release) brings transitive depenedency org.eclipse.angus:jakarta.mail.

However usage of this dependency should be discouraged in Maven/Gradle world because it's an uberjar.
So if the classpath of a module contains jakarta.mail-api or/and angus-mail dependencies we have duplication of classes.

See https://eclipse-ee4j.github.io/angus-mail/#Download_Angus_Mail_Release and also greenmail-mail-test/greenmail#553 for the detail explanation.

Suggestion: depend on jakarta.mail-api and angus-mail as recommended by Angus

Thanks for raising this.

So if the classpath of a module contains jakarta.mail-api or/and angus-mail dependencies we have duplication of classes.

I'm not sure that I understand the logic here. Doesn't the problem apply in the other direction too? If spring-boot-starter-mail depended on jakarta.mail:jakarta.mail-api and org.eclipse.angus:angus-mail and the classpath of a module contains org.eclipse.angus:jakarta.mail, wouldn't there be duplicate classes in that situation too?

@wilkinsona well in this case it's a problem of another party who included the not-recommended uberjar from org.eclipse.angus:jakarta.mail into classpath.
I guess most projects would follow the Angus's recommendations and won't do that anyway.

Looking at usage stats on Maven Central is appears to be about 1/3 org.eclipse.angus:jakarta.mail and 2/3 org.eclipse.angus:angus-mail. I don't think we should change this in 3.x as it may be unexpectedly disruptive. I think we could switch in 4.0 though.