Check out the start-tutorial
branch if you want to do the migration yourself.
Follow the steps below to complete the migration of Complete Duke from Jakarta EE 8
to Jakarta EE 9.
Update your pom.xml file to use the Jakarta EE 9 provided dependency.
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>8.0.0</version>
<scope>provided</scope>
</dependency>
or
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>8.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>9.0.0</version>
<scope>provided</scope>
</dependency>
Go through your Java source code and change all Jakarta EE 8 imports to the Jakarta EE 9 counterparts. The IDE will help you here.
import javax.*;
import jakarta.*;
Update the XML scheme references in your XML descriptor files.
Check the Jakarta EE 9 schemas.
In most cases, it is a simple replace of http://xmlns.jcp.org/xml/ns/
with https://jakarta.ee/xml/ns/
in
addition to the schema version number.
<persistence version="2.2" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd">
<persistence version="3.0" xmlns="https://jakarta.ee/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd">
Rename all properties prefixed with javax.
to be prefixed with jakarta.
.
See the example from my persistence.xml.
<property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
<property name="javax.persistence.sql-load-script-source" value="insertGreetings.sql"/>
<property name="jakarta.persistence.schema-generation.database.action" value="drop-and-create"/>
<property name="jakarta.persistence.sql-load-script-source" value="insertGreetings.sql"/>
Bootstrapping file names prefixed with javax.
, such as CDI Extensions must be renamed to be prefixed
with jakarta.
.
META-INF/services/javax.enterprise.inject.spi.Extension
META-INF/services/jakarta.enterprise.inject.spi.Extension
You may have content that is version specific, or properties/class names that are build dynamically.
If they contain the javax
namespace in any way, this must be replaced by jakarta
.
In this example, it is just the greeting message that must be updated.
insert into greeting(id,message,email) values (100, 'Howdy Jakarta EE 8!','[email protected]')
insert into greeting(id,message,email) values (100, 'Howdy Jakarta EE 9!','[email protected]')