Javax package to JakartaEE jakarta package

So you are building an JavaEE 8 ear file or war file and you also need to deploy it on a JakarteEE 9 or 10? You run into the javax to jakarta package rename problem. For some history you could read about it:

You don’t want to maintain duplicate code, you search for some automated conversion. You are still stuck on some old JavaEE 8 / JakartaEE 8 application server and there is no information if they will ever upgrade… Then the transformer-maven-plugin might be interesting for you.

Quarkus

You can read how Quarkus solved this in their product:

They used EclipseTransformer:

And OpenRewrite scripts:

Open Liberty

You can also read about Open Liberty using EclipseTransformer:

and they build a lot or rules to make migration simple for Open Liberty specific applications:

Tomcat / TomEE

Then there is Tomcat / Tomitribe who made a maven plugin voor Eclipse Transformer:

but where is the exact maven plugin documentation?

Payara

And when you are stuck on some 3rd party libraty Payara can give you some tips on how to convert such a library:

EclipseTransformer

In the end trying out the EclipseTransformer approach seems interesting. The EclipseTransformer documentation does not mention a maven plugin on the main git page. But when searching in maven you can find some maven plugin modules like:

Eclipse Transformer Jakarta EE Rules

<dependency>
    <groupId>org.eclipse.transformer</groupId>
    <artifactId>org.eclipse.transformer.jakarta</artifactId>
    <version>0.5.0</version>
</dependency>

Eclipse Transformer provides tools and runtime components that transform Java binaries, such as individual class files and complete JARs and WARs, mapping changes to Java packages, type names, and related resource names.

<dependency>
    <groupId>org.eclipse.transformer</groupId>
    <artifactId>transformer-maven-plugin</artifactId>
    <version>0.5.0</version>
</dependency>

Looking at the source code of this transformer-maven-plugin you can find the documentation in git on: https://github.com/eclipse/transformer/tree/main/maven-plugins/transformer-maven-plugin

And with a simple:

<plugin>
    <groupId>org.eclipse.transformer</groupId>
    <artifactId>transformer-maven-plugin</artifactId>
    <version>0.5.0</version>
    <extensions>true</extensions>
    <configuration>
        <rules>
            <jakartaDefaults>true</jakartaDefaults>
        </rules>
    </configuration>
    <executions>
        <execution>
            <id>default-jar</id>
            <goals>
                <goal>jar</goal>
            </goals>
            <configuration>
                <baseName>your.newjakartaee.ear.name</baseName>
                <artifact>
                    <groupId>your.application.groupid</groupId>
                    <artifactId>your.ear.artifactid</artifactId>
                    <version>1.2.3-SNAPSHOT</version>
                </artifact>
            </configuration>
        </execution>
    </executions>
</plugin>

you can use the maven build to convert your JavaEE 8 ear or war file into a JakartaEE ear file.