[
https://issues.apache.org/jira/browse/EMAIL-214?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18070983#comment-18070983
]
Makarand Hinge edited comment on EMAIL-214 at 4/4/26 4:25 AM:
--------------------------------------------------------------
Hi [~jhstcde] [~ggregory],
A couple of approaches can be used to resolve this:
*Option 1: Exclude jakarta.mail from the dependency*
{{<dependency>}}
<groupId>org.apache.commons</groupId>
<artifactId>commons-email2</artifactId>
<version>2.x.x</version>
<exclusions>
{{<exclusion>}}
<groupId>jakarta.mail</groupId>
<artifactId>jakarta.mail-api</artifactId>
{{</exclusion>}}
</exclusions>
{{</dependency>}}
*Option 2: Mark jakarta.mail as provided*
{{<dependency>}}
<groupId>jakarta.mail</groupId>
<artifactId>jakarta.mail-api</artifactId>
<version>2.0.1</version>
<scope>provided</scope>
{{</dependency>}}
Both approaches ensure that Jakarta Mail is available at compile time but not
packaged into the final WAR, avoiding conflicts with server-provided
implementations.
was (Author: indy):
Hi [~jhstcde],
A couple of approaches can be used to resolve this:
*Option 1: Exclude jakarta.mail from the dependency*
{{<dependency>}}
<groupId>org.apache.commons</groupId>
<artifactId>commons-email2</artifactId>
<version>2.x.x</version>
<exclusions>
{{<exclusion>}}
<groupId>jakarta.mail</groupId>
<artifactId>jakarta.mail-api</artifactId>
{{</exclusion>}}
</exclusions>
{{</dependency>}}
*Option 2: Mark jakarta.mail as provided*
{{<dependency>}}
<groupId>jakarta.mail</groupId>
<artifactId>jakarta.mail-api</artifactId>
<version>2.0.1</version>
<scope>provided</scope>
{{</dependency>}}
Both approaches ensure that Jakarta Mail is available at compile time but not
packaged into the final WAR, avoiding conflicts with server-provided
implementations.
> commons-mail2 maven adds jakarta.mail.2.0.1 to WEB-INF/lib interfering with
> server shipped version
> --------------------------------------------------------------------------------------------------
>
> Key: EMAIL-214
> URL: https://issues.apache.org/jira/browse/EMAIL-214
> Project: Commons Email
> Issue Type: Bug
> Affects Versions: 2.0.0-M1
> Reporter: Jens Heitmann
> Priority: Major
>
> The supplied version in the mvnrepository add's jakarta.mail as a dependency.
> Downloading it to WEB-INF/lib add jakarta.mail as a dependency too, which
> interferes i.E. with the version supplied with Apache Tomee.
> If jakarta.mail is part of the server dependency is obsolete for deployment
> and only required during build phase. If this is added to war file it may
> interfere with i.E. eclipse-angus or Geronimo-mail
--
This message was sent by Atlassian Jira
(v8.20.10#820010)