Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use Greenmail with Spring Boot 3 #512

Open
bodiam opened this issue Jan 2, 2023 · 3 comments
Open

Cannot use Greenmail with Spring Boot 3 #512

bodiam opened this issue Jan 2, 2023 · 3 comments
Assignees

Comments

@bodiam
Copy link

bodiam commented Jan 2, 2023

Hi all,

I'm currently affected by this issue: spring-projects/spring-boot#33452

I also have this problem with Spring Boot 3 and Greenmail, but I'm using Greenmail Alpha 3, and the only dependency I have depending on com.sun.activation:jakarta.activation:2.0.1 is Greenmail:

+--- com.icegreen:greenmail-junit5:2.0.0-alpha-3
|    +--- com.icegreen:greenmail:2.0.0-alpha-3
|    |    +--- com.sun.mail:jakarta.mail:2.0.1
|    |    |    \--- com.sun.activation:jakarta.activation:2.0.1
|    |    +--- jakarta.activation:jakarta.activation-api:2.0.1 -> 2.1.0
|    |    +--- org.slf4j:slf4j-api:1.7.36 -> 2.0.4
|    |    \--- junit:junit:4.13.2 (*)
|    \--- org.junit.jupiter:junit-jupiter-api:5.9.1 (*)

Shouldn't Greenmail stop depending on this? (I thought that was the main reason to use Greenmail 2.0?)

@marcelmay marcelmay self-assigned this Jan 2, 2023
@marcelmay
Copy link
Member

@bodiam , try to exclude the transitive dependency on com.sun.activation:jakarta.activation.

GreenMail depends on Jakarta Mail, which again brings along jakarta.activation implementation of com.sun.activation:jakarta.activation.

Spring Boot 3 brings along jakarta.activation implementation of org.eclipse.angus:angus-activation, pulled in by Angus Mail .

So you have to exclude one of them, to avoid conflict from having two implementations.

Exclude either angus-activation ...

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-mail</artifactId>
    <exclusions>
        <exclusion>
            <groupId>org.eclipse.angus</groupId>
            <artifactId>angus-activation</artifactId>
        </exclusion>
    </exclusions>
</dependency>

... or (old Jakarta Mail 2.x) com.sun.mail implementation:

<dependency>
    <groupId>com.icegreen</groupId>
    <artifactId>greenmail-junit5</artifactId>
    <version>2.0.0-alpha-3</version>
    <scope>test</scope>
    <exclusions>
        <exclusion>
            <groupId>com.sun.mail</groupId>
            <artifactId>jakarta.mail</artifactId>
        </exclusion>
    </exclusions>
</dependency>

For a Spring Boot 3 application, I'd recommend to exclude GreenMails com.sun.mail:jakarta.mail .

Migrating GreenMail to Angus-Mail 2.1 is work-in-progress and planned for GreenMail 2.1 (version parity with Jakarta Mail 2.1).

@marcelmay
Copy link
Member

@bodiam
Copy link
Author

bodiam commented Jan 3, 2023

@marcelmay Thanks for the example and the explanation. I was under the impression that alpha-3 would already have fixed this. For the time being, I added this to my build.gradle.kts:

configurations.all {
    resolutionStrategy {
        exclude("com.sun.activation", "jakarta.activation")
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants