'Migrate from javax to jakarta ee
So I have a small application (not running in a web container) that uses some javax.* classes running on jdk8. The time has come to upgrade to jdk17. So I thought,easy enough, I download the jakarta ee 9 (or 10) reference implementation .jar files, switch in the code javax. to jakarta.* namespace and we are good to go. Seems I can't find where I can download the reference implementation *jar files for jakarta ee 9 (or 10). So obviously I'm missing something. Can someone guide me to the good approach to solve this ?
Solution 1:[1]
I mostly use maven to handle my dependencies but hope this helps at least a bit.
For jaxb 3.x you can use following api-dependency
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>3.0.1</version>
</dependency>
Then for implementation you can use the following.
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>3.0.0</version>
</dependency>
If you need to generate classes from xsd you can use jaxb2-maven-plugin 3.1.0. It seems to only depend on jakarta.xml.bind-api while including rest as nested dependencies.
<!--
by default searches schemas from src/main/xsd
and binding files from src/main/xjb
-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>xjc</id>
<goals>
<goal>xjc</goal>
</goals>
</execution>
</executions>
<configuration>
<packageName>com.example.api</packageName>
</configuration>
</plugin>
Not sure about javax.activation
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Pasi Österman |