/
Deploying legacy WARs to Tomcat 10.x onwards
Deploying legacy WARs to Tomcat 10.x onwards
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:
j2ee
andjavaee
WARs are deployed into thelegacyAppBase
folder, steered through the property value forTomcatPropertySet.WEBAPPS_LEGACY_DIRECTORY
- All other WARs, including WARs without any specific indication, are deployed "as usual" into the
appBase
folder, steered through the property value forTomcatPropertySet.WEBAPPS_DIRECTORY
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>
, multiple selections available,
Related content
Tomcat 10.x
Tomcat 10.x
More like this
Tomcat 11.x
Tomcat 11.x
More like this
TomEE 10.x
TomEE 10.x
More like this
TomEE 9.x
TomEE 9.x
More like this
Static deployment of expanded WAR
Static deployment of expanded WAR
More like this
Deployable
Deployable
More like this