Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Several java 'activation' libraries define overlapping classes. Which one to use?

I am using the latest stable version of quite standard Java libraries such as Spring, yet getting 'overlapping classes' warning from maven shade plugin about three different libraries that define the same classes.

The libraries: jakarta.activation-api, javax.activation-api, activation.

Specifically:

  1. jakarta.activation:jakarta.activation-api:jar:1.2.2 (dependency of jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.3)
  2. javax.activation:javax.activation-api:jar:1.2.0 (dependency of javax.xml.bind:jaxb-api:jar:2.3.1, I think this one should be replaced by jakarta.xml.bind-api, but not sure)
  3. javax.activation:activation:jar:1.1 (dependency of com.sun.mail:javax.mail:jar:1.6.2)

What library is the 'right' one that will cause the least amount of trouble?

Update: it seems that jakarta.xml.bind-api replaces javax.xml.bind:jaxb-api (proof: here and here), so in the conflict between (1) and (2) the jakarta one (jakarta.activation-api) should be preferred over the javax one (javax.activation-api). The preferred JAXB dependencies are described in Jakarta web site. But it is still unclear how is this related to javax.activation:activation.

like image 636
Alexander Avatar asked Jun 11 '20 11:06

Alexander


1 Answers

Finally got it.
JavaBeans activation framework has been moved to Jakarta Activation, see Jakarta JAF page, it means javax.activation:activation is out of date.
The right one seems to be jakarta activation, thanks to this answer.

Same for emails and XML processing that require the activation JAR - use the Jakarta ones: com.sun.mail:jakarta.mail and jakarta.xml.bind:jakarta.xml.bind-api.

like image 99
Alexander Avatar answered Oct 08 '22 18:10

Alexander