I think GreenMail should add a dependency on org.eclipse.angus:angus-mail and remove its dependency on org.eclipse.angus:jakarta.mail.
When I upgraded GreenMail from 2.0.0-alpha-3 to 2.0.1-alpha-1, I had to exclude the dependency on org.eclipse.angus:jakarta.mail in order to resolve duplicate class errors reported by the Maven Enforcer Plugin. That jakarta.mail artifact bundles the classes from two other artifacts: org.eclipse.angus:angus-mail and jakarta.mail:jakarta.mail-api. If either of those other artifacts show up in your dependency tree, you'll have duplicate classes. In particular, GreenMail also depends on jakarta.mail-api, so you will have duplicate classes if you depend on GreenMail 2.0.1-alpha-1.
The release notes for Angus Mail confirm that my suggested approach is the "preferred" way:
Preferred way of using Angus Mail jar files is to use Jakarta Mail API with Angus Mail runtime:
| jar file |
module name |
groupId |
artifactId |
Description |
| jakarta.mail-api.jar |
jakarta.mail |
jakarta.mail |
jakarta.mail-api |
The Jakarta Mail API definitions only, suitable for compiling against |
| angus-mail.jar |
org.eclipse.angus.mail |
org.eclipse.angus |
angus-mail |
The Angus Mail runtime jar file, including the SMTP, IMAP, and POP3 protocol providers and java.util.logging handler |
| gimap.jar |
org.eclipse.angus.mail.gimap |
org.eclipse.angus |
gimap |
An EXPERIMENTAL Gmail IMAP protocol provider that supports Gmail-specific features |
| dsn.jar |
org.eclipse.angus.mail.dsn |
org.eclipse.angus |
dsn |
Support for parsing and creating messages containing Delivery Status Notifications |
whereas jakarta.mail can be used if you're trying to limit the number of dependencies for some reason. Personally, I feel like artifacts that bundle other artifacts don't play well with Maven-managed dependencies, and they're meant to be used on projects with more manual dependency management.
I think GreenMail should add a dependency on
org.eclipse.angus:angus-mailand remove its dependency onorg.eclipse.angus:jakarta.mail.When I upgraded GreenMail from 2.0.0-alpha-3 to 2.0.1-alpha-1, I had to exclude the dependency on
org.eclipse.angus:jakarta.mailin order to resolve duplicate class errors reported by the Maven Enforcer Plugin. Thatjakarta.mailartifact bundles the classes from two other artifacts:org.eclipse.angus:angus-mailandjakarta.mail:jakarta.mail-api. If either of those other artifacts show up in your dependency tree, you'll have duplicate classes. In particular, GreenMail also depends onjakarta.mail-api, so you will have duplicate classes if you depend on GreenMail 2.0.1-alpha-1.The release notes for Angus Mail confirm that my suggested approach is the "preferred" way:
whereas
jakarta.mailcan be used if you're trying to limit the number of dependencies for some reason. Personally, I feel like artifacts that bundle other artifacts don't play well with Maven-managed dependencies, and they're meant to be used on projects with more manual dependency management.