Definition

Tomcat 10.x onwards uses Jakarta EE, which is not backwards compatible with J2EE / Java EE.

To ease migration, a Jakarta EE migration tool is part of Tomcat, and through the legacyAppBase configuration property allows automatic conversion of legacy WARs to Jakarta EE WARs.

Codehaus Cargo 1.10.14 introduced a functionality to benefit for the same, by providing a property called version on Deployable objects, to specify whether it is j2ee, javaee or jakartaee and enable the Tomcat deployer to handle it accordingly:

Example using the Java API

LocalContainer container = new Tomcat10xInstalledLocalContainer(
    new Toncat10xStandaloneConfiguration("target/tomcat10x"));
container.setHome("c:/tomcat/tomcat-10.1.23");

Deployable war = new WAR("src/data/some.war");
war.setVersion(DeployableVersion.JAVA_EE);
container.getConfiguration().addDeployable(war);

container.start();

Example using the Ant tasks

<cargo containerId="tomcat10x" home="c:/tomcat/tomcat-10.1.23" action="start">
  <configuration>
    <deployable type="war" file="path/to/some-war.war">
      <property name="version" value="javaee"/>
    </deployable>
  </configuration>
</cargo>

Example using the Maven 3 plugin

<dependencies>
  <dependency>
    <groupId>org.codehaus.cargo</groupId>
    <artifactId>simple-war</artifactId>
    <version>${simple-war.version}</version>
    <type>war</type>
  </dependency>
</dependencies>

<plugins>
  <plugin>
    <groupId>org.codehaus.cargo</groupId>
    <artifactId>cargo-maven3-plugin</artifactId>
    <version>${cargo.version}</version>
    <configuration>
      <container>
        <containerId>tomcat10x</containerId>
        <artifactInstaller>
          <groupId>org.apache.tomcat</groupId>
          <artifactId>tomcat</artifactId>
          <version>10.1.23</version>
        </artifactInstaller>
      </container>
      <deployables>
        <deployable>
          <groupId>org.codehaus.cargo</groupId>
          <artifactId>simple-war</artifactId>
          <type>war</type>
          <properties>
            <version>javaee</version>
          </properties>
        </deployable>
      </deployables>
    </configuration>
  </plugin>
</plugins>
Copyright 2004-2024. All rights reserved unless otherwise noted.
Click here to read our privacy and cookie policy