Skip to content

Commit

Permalink
Merge pull request quarkusio#24915 from gsmet/jakarta-progress-4
Browse files Browse the repository at this point in the history
Jakarta migration: more progress
  • Loading branch information
gsmet authored Apr 13, 2022
2 parents 2a8640a + c55cc92 commit 04a67c8
Show file tree
Hide file tree
Showing 13 changed files with 284 additions and 14 deletions.
30 changes: 28 additions & 2 deletions build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<htmlunit.version>2.40.0</htmlunit.version>
<javaparser-core.version>3.24.2</javaparser-core.version>
<jdeparser.version>2.0.3.Final</jdeparser.version>
<subethasmtp.version>3.1.7</subethasmtp.version>
<subethasmtp.version>5.2.8</subethasmtp.version>

<!-- Dev tools -->
<freemarker.version>2.3.31</freemarker.version>
Expand Down Expand Up @@ -312,7 +312,7 @@
</dependency>

<dependency>
<groupId>org.subethamail</groupId>
<groupId>com.github.davidmoten</groupId>
<artifactId>subethasmtp</artifactId>
<version>${subethasmtp.version}</version>
<scope>test</scope>
Expand Down Expand Up @@ -1226,5 +1226,31 @@
</properties>
</profile>

<profile>
<id>jakarta-rewrite</id>
<activation>
<property>
<name>jakarta-rewrite</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<version>4.21.0-SNAPSHOT</version>
<configuration>
<configLocation>${maven.multiModuleProjectDirectory}/jakarta/rewrite.yml</configLocation>
<activeStyles>
<style>io.quarkus.style.maven</style>
</activeStyles>
<activeRecipes>
<recipe>io.quarkus.build-parent</recipe>
</activeRecipes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
28 changes: 28 additions & 0 deletions extensions/hibernate-envers/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
</exclusion>

<!-- Following dependencies are only necessary during metadata initialization -->
<exclusion>
<groupId>jakarta.activation</groupId>
<artifactId>jakarta.activation-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.activation</groupId>
<artifactId>javax.activation-api</artifactId>
Expand Down Expand Up @@ -77,4 +81,28 @@
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>jakarta-rewrite</id>
<activation>
<property>
<name>jakarta-rewrite</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<configuration>
<activeRecipes>
<recipe>io.quarkus.hibernate-orm-narayana-switch</recipe>
</activeRecipes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
23 changes: 23 additions & 0 deletions extensions/kubernetes-client/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,28 @@
</plugins>
</build>

<profiles>
<profile>
<id>jakarta-rewrite</id>
<activation>
<property>
<name>jakarta-rewrite</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<configuration>
<activeRecipes>
<recipe>io.quarkus.jakarta-jaxb-switch</recipe>
</activeRecipes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
2 changes: 1 addition & 1 deletion extensions/mailer/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<artifactId>smallrye-mutiny-vertx-mail-client</artifactId>
</dependency>
<dependency>
<groupId>org.subethamail</groupId>
<groupId>com.github.davidmoten</groupId>
<artifactId>subethasmtp</artifactId>
<scope>test</scope>
<exclusions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ class MailerImplTest {

@BeforeAll
static void startWiser() {
wiser = new Wiser();
wiser.setPort(0);
wiser = Wiser.port(SocketUtil.findAvailablePort());
wiser.start();

vertx = Vertx.vertx();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;
import java.util.UUID;

import javax.mail.BodyPart;
import javax.mail.MessagingException;
Expand Down Expand Up @@ -41,8 +46,7 @@ class MailerWithMultipartImplTest {

@BeforeAll
static void startWiser() {
wiser = new Wiser();
wiser.setPort(0);
wiser = Wiser.port(SocketUtil.findAvailablePort());
wiser.start();

vertx = Vertx.vertx();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package io.quarkus.mailer.runtime;

import java.io.IOException;
import java.net.ServerSocket;

final class SocketUtil {

private SocketUtil() {
}

static int findAvailablePort() {
ServerSocket serverSocket = null;
try {
serverSocket = new ServerSocket(0);
return serverSocket.getLocalPort();
} catch (Exception e) {
// return a default port
return 25347;
} finally {
if (serverSocket != null) {
try {
serverSocket.close();
} catch (IOException e) {
}
}
}
}
}
24 changes: 24 additions & 0 deletions extensions/security-webauthn/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,28 @@
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>jakarta-rewrite</id>
<activation>
<property>
<name>jakarta-rewrite</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<configuration>
<activeRecipes>
<recipe>io.quarkus.jakarta-jaxrs-switch</recipe>
</activeRecipes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
24 changes: 24 additions & 0 deletions extensions/smallrye-opentracing/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,28 @@
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>jakarta-rewrite</id>
<activation>
<property>
<name>jakarta-rewrite</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<configuration>
<activeRecipes>
<recipe>io.quarkus.jakarta-jaxrs-switch</recipe>
</activeRecipes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
25 changes: 21 additions & 4 deletions jakarta/rewrite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ recipeList:
oldGroupId: org.hibernate
oldArtifactId: hibernate-envers
newGroupId: org.hibernate
newArtifactId: hibernate-envers-jakarta
- org.openrewrite.maven.ChangeManagedDependencyGroupIdAndArtifactId:
oldGroupId: org.hibernate
oldArtifactId: hibernate-jpamodelgen
Expand Down Expand Up @@ -208,6 +209,14 @@ recipeList:
artifactId: jakarta.xml.bind-api
---
type: specs.openrewrite.org/v1beta/recipe
name: io.quarkus.build-parent
displayName: Adjust build-parent
recipeList:
- org.openrewrite.maven.ChangePropertyValue:
key: subethasmtp.version
newValue: 6.0.1
---
type: specs.openrewrite.org/v1beta/recipe
name: io.quarkus.jakarta-security
displayName: Adjust Javax security dependencies
recipeList:
Expand Down Expand Up @@ -368,6 +377,12 @@ recipeList:
- org.openrewrite.maven.ChangePropertyValue:
key: smallrye-health.version
newValue: 4.0.0-RC2
- org.openrewrite.maven.ChangePropertyValue:
key: microprofile-jwt.version
newValue: 2.0
- org.openrewrite.maven.ChangePropertyValue:
key: smallrye-jwt.version
newValue: 4.0.0-RC1
- org.openrewrite.maven.ChangePropertyValue:
key: microprofile-metrics-api.version
newValue: 4.0.1
Expand All @@ -377,17 +392,19 @@ recipeList:
- org.openrewrite.maven.ChangePropertyValue:
key: smallrye-open-api.version
newValue: 3.0.0-RC1
- org.openrewrite.maven.ChangePropertyValue:
key: microprofile-opentracing-api.version
newValue: 3.0
- org.openrewrite.maven.ChangePropertyValue:
key: smallrye-opentracing.version
newValue: 3.0.0-RC1
- org.openrewrite.maven.ChangePropertyValue:
key: microprofile-rest-client.version
newValue: 3.0
# In progress, these ones need a change:
# <microprofile-opentracing-api.version>2.0</microprofile-opentracing-api.version>
# <microprofile-reactive-streams-operators.version>1.0.1</microprofile-reactive-streams-operators.version>
# <microprofile-jwt.version>1.2</microprofile-jwt.version>
# <microprofile-lra.version>1.0</microprofile-lra.version>
# <smallrye-graphql.version>1.4.3</smallrye-graphql.version>
# <smallrye-opentracing.version>2.1.0</smallrye-opentracing.version>
# <smallrye-jwt.version>3.3.3</smallrye-jwt.version>
# <smallrye-reactive-streams-operators.version>1.0.13</smallrye-reactive-streams-operators.version>
# <smallrye-reactive-types-converter.version>2.6.0</smallrye-reactive-types-converter.version>
# <smallrye-mutiny-vertx-binding.version>2.19.0</smallrye-mutiny-vertx-binding.version>
Expand Down
53 changes: 51 additions & 2 deletions jakarta/transform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ clean_project
./mvnw -B -pl :quarkus-platform-descriptor-json-plugin -pl :quarkus-bootstrap-maven-plugin -pl :quarkus-enforcer-rules -am clean install -DskipTests -DskipITs -Dinvoker.skip

## we cannot rewrite some of the modules for various reasons but we rewrite most of them
./mvnw -B -e rewrite:run -Denforcer.skip -Dprotoc.skip -Dmaven.main.skip -Dmaven.test.skip -Dforbiddenapis.skip -Dinvoker.skip -pl '!:quarkus-bom-quarkus-platform-descriptor' -pl '!:io.quarkus.gradle.plugin' -pl '!:io.quarkus.extension.gradle.plugin' -pl '!:quarkus-cli' -pl '!:quarkus-documentation' -Dno-test-modules -Drewrite.pomCacheEnabled=false -Djakarta-rewrite
./mvnw -B -e rewrite:run -Denforcer.skip -Dprotoc.skip -Dmaven.main.skip -Dmaven.test.skip -Dforbiddenapis.skip -Dinvoker.skip -pl '!:quarkus-bom-quarkus-platform-descriptor' -pl '!:io.quarkus.gradle.plugin' -pl '!:io.quarkus.extension.gradle.plugin' -pl '!:quarkus-cli' -pl '!:quarkus-documentation' -pl '!:quarkus-integration-tests-parent' -Dno-test-modules -Drewrite.pomCacheEnabled=false -Djakarta-rewrite

## remove banned dependencies
remove_banned_dependency "independent-projects/bootstrap" 'javax.inject:javax.inject' 'we allow javax.inject for Maven'
Expand Down Expand Up @@ -362,7 +362,6 @@ build_module "extensions/smallrye-openapi-common"
build_module "extensions/swagger-ui"
build_module "extensions/smallrye-openapi"
build_module "extensions/smallrye-health"
# TODO: tests are not passing for now, I pinged Jan
build_module "extensions/smallrye-metrics"

# Persistence
Expand Down Expand Up @@ -399,12 +398,62 @@ build_module "extensions/reactive-pg-client"
build_module "test-framework/vertx"
build_module "extensions/hibernate-reactive"

# And now in alphabetical order (dependency aside)...
# TODO apicurio-registry-avro depends on old JAX-RS spec
build_module "extensions/awt"
build_module "extensions/azure-functions-http"
build_module "extensions/cache"
build_module "extensions/config-yaml"
build_module "extensions/kubernetes-client"
build_module "extensions/container-image"
build_module "extensions/elytron-security-jdbc"
build_module "test-framework/ldap"
build_module "extensions/elytron-security-ldap"
build_module "extensions/elytron-security-oauth2"
build_module "extensions/flyway"
build_module "extensions/funqy"
build_module "extensions/google-cloud-functions"
build_module "extensions/google-cloud-functions-http"
build_module "extensions/grpc-common"
build_module "extensions/grpc"
build_module "extensions/hibernate-envers"
build_module "extensions/infinispan-client"
build_module "extensions/jaeger"
build_module "extensions/kafka-client"
build_module "test-framework/junit5-mockito-config"
build_module "test-framework/junit5-mockito"
build_module "extensions/kafka-streams"
build_module "test-framework/keycloak-server"
# TODO we need a keycloak-admin-client-jakarta
#build_module "extensions/keycloak-admin-client"
#build_module "extensions/keycloak-admin-client-reactive"
build_module "extensions/smallrye-jwt-build"
build_module "extensions/oidc-common"
build_module "extensions/oidc"
# TODO we need the quarkus-keycloak-admin-client extension
#build_module "extensions/keycloak-authorization"
build_module "extensions/kubernetes"
build_module "extensions/kubernetes-config"
build_module "extensions/liquibase"
build_module "extensions/reactive-streams-operators"
build_module "extensions/smallrye-opentracing"
build_module "extensions/mongodb-client"
build_module "extensions/liquibase-mongodb"
build_module "extensions/logging-gelf"
build_module "extensions/logging-json"
build_module "extensions/mailer"
build_module "extensions/micrometer"
build_module "extensions/micrometer-registry-prometheus"
# TODO we need a narayana-lra Jakarta extension (dependency of MP spec and CDI spec)
#build_module "extensions/narayana-lra"

exit 0

# These ones require ArC and Mutiny extensions
#build_module "test-framework/junit5-mockito-config"
#build_module "test-framework/junit5-mockito"


# Dev Tools - needs to be done after all the extensions have been built and before we run the ITs
#transform_module "devtools"
#build_module_no_tests "devtools"
Expand Down
Loading

0 comments on commit 04a67c8

Please sign in to comment.