This is an automated email from the ASF dual-hosted git repository. jlmonteiro pushed a commit to branch javax-to-jakarta-on-deploy in repository https://gitbox.apache.org/repos/asf/tomee.git
commit 209d33ed1a045d43d584e284bba1d9c1199842ab Author: Jean-Louis Monteiro <[email protected]> AuthorDate: Thu Oct 20 17:18:17 2022 +0200 Update Arquillian such as it supports converting archives on the fly --- arquillian/arquillian-tomee-common/pom.xml | 6 ++++ .../arquillian/common/TomEEConfiguration.java | 9 ++++++ .../openejb/arquillian/common/TomEEContainer.java | 31 ++++++++++++++++++++ boms/tomee-microprofile/pom.xml | 33 ++++++++++++++++++++++ examples/pom.xml | 1 + examples/serverless-tomee-plume/pom.xml | 2 +- .../tomee-microprofile-webapp/pom.xml | 7 +++++ tomee/tomee-plume-webapp/pom.xml | 7 +++++ tomee/tomee-plus-webapp/pom.xml | 7 +++++ tomee/tomee-webapp/pom.xml | 7 +++++ 10 files changed, 109 insertions(+), 1 deletion(-) diff --git a/arquillian/arquillian-tomee-common/pom.xml b/arquillian/arquillian-tomee-common/pom.xml index 7585e31acc..67cc070771 100644 --- a/arquillian/arquillian-tomee-common/pom.xml +++ b/arquillian/arquillian-tomee-common/pom.xml @@ -102,6 +102,12 @@ </exclusion> </exclusions> </dependency> + <dependency> + <groupId>org.apache.tomcat</groupId> + <artifactId>jakartaee-migration</artifactId> + <classifier>shaded</classifier> + <version>1.0.4</version> + </dependency> <dependency> <groupId>org.apache.tomee</groupId> <artifactId>openejb-loader</artifactId> diff --git a/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEConfiguration.java b/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEConfiguration.java index 1a3b2f325c..592a9dc49b 100644 --- a/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEConfiguration.java +++ b/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEConfiguration.java @@ -47,6 +47,7 @@ public class TomEEConfiguration implements ContainerConfiguration { protected boolean quickSession = true; protected boolean unsafeEjbd = true; protected boolean unpackWars = true; + protected boolean convertFromJavax = false; protected String properties = ""; protected String webContextToUseWithEars; @@ -79,6 +80,14 @@ public class TomEEConfiguration implements ContainerConfiguration { this.unpackWars = unpackWars; } + public boolean isConvertFromJavax() { + return convertFromJavax; + } + + public void setConvertFromJavax(final boolean convertFromJavax) { + this.convertFromJavax = convertFromJavax; + } + public int getHttpsPort() { return httpsPort; } diff --git a/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java b/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java index c0764d4d13..8d6bf09dd3 100644 --- a/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java +++ b/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java @@ -27,6 +27,8 @@ import org.apache.openejb.assembler.classic.ServletInfo; import org.apache.openejb.assembler.classic.WebAppInfo; import org.apache.openejb.loader.Options; import org.apache.openejb.util.NetworkUtil; +import org.apache.tomcat.jakartaee.EESpecProfile; +import org.apache.tomcat.jakartaee.Migration; import org.jboss.arquillian.container.spi.client.container.DeployableContainer; import org.jboss.arquillian.container.spi.client.container.DeploymentException; import org.jboss.arquillian.container.spi.client.container.LifecycleException; @@ -348,6 +350,27 @@ public abstract class TomEEContainer<Configuration extends TomEEConfiguration> i } } + private void migrateLegacyApp(final File source) { + try { + // delegate to Tomcat migration tool + Migration migration = new Migration(); + migration.setSource(source); + migration.setDestination(source); // in place replacement + migration.setEESpecProfile(EESpecProfile.EE); + migration.addExclude("tomee-*.jar"); + migration.addExclude("openejb-*.jar"); + migration.addExclude("openwebbeans-*.jar"); + migration.addExclude("geronimo-*.jar"); + migration.addExclude("openjpa-*.jar"); + migration.addExclude("cxf-*.jar"); + migration.addExclude("arquillian-*.jar"); + migration.execute(); + + } catch (Throwable t) { + throw new RuntimeException(t); + } + } + protected Collection<AppInfo> getDeployedApps() throws NamingException { return deployer().getDeployedApps(); } @@ -421,6 +444,14 @@ public abstract class TomEEContainer<Configuration extends TomEEConfiguration> i + "\n"); } + if (configuration.isConvertFromJavax()) { + try { + migrateLegacyApp(file); + + } catch (final Exception e) { + LOGGER.warning("Failed to migrate application " + file.getAbsolutePath()); + } + } return new Dump(file, created); } diff --git a/boms/tomee-microprofile/pom.xml b/boms/tomee-microprofile/pom.xml index 5c3b9628ee..2f8f281e25 100644 --- a/boms/tomee-microprofile/pom.xml +++ b/boms/tomee-microprofile/pom.xml @@ -199,6 +199,17 @@ </exclusion> </exclusions> </dependency> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <version>2.11.0</version> + <exclusions> + <exclusion> + <artifactId>*</artifactId> + <groupId>*</groupId> + </exclusion> + </exclusions> + </dependency> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> @@ -540,6 +551,17 @@ </exclusion> </exclusions> </dependency> + <dependency> + <groupId>org.apache.bcel</groupId> + <artifactId>bcel</artifactId> + <version>6.5.0</version> + <exclusions> + <exclusion> + <artifactId>*</artifactId> + <groupId>*</groupId> + </exclusion> + </exclusions> + </dependency> <dependency> <groupId>org.apache.bval</groupId> <artifactId>bval-jsr</artifactId> @@ -552,6 +574,17 @@ </exclusion> </exclusions> </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-compress</artifactId> + <version>1.21</version> + <exclusions> + <exclusion> + <artifactId>*</artifactId> + <groupId>*</groupId> + </exclusion> + </exclusions> + </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> diff --git a/examples/pom.xml b/examples/pom.xml index 85175358cb..ab23d5a637 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -93,6 +93,7 @@ <module>javamail</module> <module>javamail-velocity</module> <module>java-modules</module> + <module>javax-to-jakarta-namespace</module> <module>jaxrs-filter</module> <module>jaxrs-json-provider-jettison</module> <module>jpa-eclipselink</module> diff --git a/examples/serverless-tomee-plume/pom.xml b/examples/serverless-tomee-plume/pom.xml index 33c2c5de7e..2556088bbd 100644 --- a/examples/serverless-tomee-plume/pom.xml +++ b/examples/serverless-tomee-plume/pom.xml @@ -31,7 +31,7 @@ <dependencies> <dependency> <groupId>org.apache.tomee.bom</groupId> - <artifactId>tomee-webprofile</artifactId> + <artifactId>tomee-plume</artifactId> <version>${version.tomee}</version> </dependency> <dependency> diff --git a/tomee/tomee-microprofile/tomee-microprofile-webapp/pom.xml b/tomee/tomee-microprofile/tomee-microprofile-webapp/pom.xml index f36f416578..9fbc72d10c 100644 --- a/tomee/tomee-microprofile/tomee-microprofile-webapp/pom.xml +++ b/tomee/tomee-microprofile/tomee-microprofile-webapp/pom.xml @@ -186,6 +186,13 @@ </exclusions> <scope>runtime</scope> </dependency> + <dependency> + <groupId>org.apache.tomcat</groupId> + <artifactId>jakartaee-migration</artifactId> + <classifier>shaded</classifier> + <version>1.0.4</version> + <scope>runtime</scope> + </dependency> <dependency> <groupId>${project.groupId}</groupId> <artifactId>tomee-catalina</artifactId> diff --git a/tomee/tomee-plume-webapp/pom.xml b/tomee/tomee-plume-webapp/pom.xml index 87136f7f19..8d5d4302d6 100644 --- a/tomee/tomee-plume-webapp/pom.xml +++ b/tomee/tomee-plume-webapp/pom.xml @@ -245,6 +245,13 @@ </exclusions> <scope>runtime</scope> </dependency> + <dependency> + <groupId>org.apache.tomcat</groupId> + <artifactId>jakartaee-migration</artifactId> + <classifier>shaded</classifier> + <version>1.0.4</version> + <scope>runtime</scope> + </dependency> <dependency> <groupId>${project.groupId}</groupId> <artifactId>tomee-catalina</artifactId> diff --git a/tomee/tomee-plus-webapp/pom.xml b/tomee/tomee-plus-webapp/pom.xml index c3c07a64ec..0c614ca95a 100644 --- a/tomee/tomee-plus-webapp/pom.xml +++ b/tomee/tomee-plus-webapp/pom.xml @@ -237,6 +237,13 @@ </exclusions> <scope>runtime</scope> </dependency> + <dependency> + <groupId>org.apache.tomcat</groupId> + <artifactId>jakartaee-migration</artifactId> + <classifier>shaded</classifier> + <version>1.0.4</version> + <scope>runtime</scope> + </dependency> <dependency> <groupId>${project.groupId}</groupId> <artifactId>tomee-catalina</artifactId> diff --git a/tomee/tomee-webapp/pom.xml b/tomee/tomee-webapp/pom.xml index 6bc5e42467..e57fb6918f 100644 --- a/tomee/tomee-webapp/pom.xml +++ b/tomee/tomee-webapp/pom.xml @@ -315,6 +315,13 @@ </exclusions> <scope>runtime</scope> </dependency> + <dependency> + <groupId>org.apache.tomcat</groupId> + <artifactId>jakartaee-migration</artifactId> + <classifier>shaded</classifier> + <version>1.0.4</version> + <scope>runtime</scope> + </dependency> <dependency> <groupId>${project.groupId}</groupId> <artifactId>tomee-catalina</artifactId>
