From 1e0d016103b3768f090a419d99ed66f1b287c42c Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Mon, 25 Sep 2023 15:23:56 +0300 Subject: [PATCH] Allow using RESTEasy Classic test deps when app is RESTEasy Reactive app Fixes: #36124 --- .../deployment/ResteasyReactiveCommonProcessor.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive-common/deployment/src/main/java/io/quarkus/resteasy/reactive/common/deployment/ResteasyReactiveCommonProcessor.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive-common/deployment/src/main/java/io/quarkus/resteasy/reactive/common/deployment/ResteasyReactiveCommonProcessor.java index 1daa129defa91..1cd637de9d32f 100644 --- a/extensions/resteasy-reactive/quarkus-resteasy-reactive-common/deployment/src/main/java/io/quarkus/resteasy/reactive/common/deployment/ResteasyReactiveCommonProcessor.java +++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive-common/deployment/src/main/java/io/quarkus/resteasy/reactive/common/deployment/ResteasyReactiveCommonProcessor.java @@ -87,17 +87,22 @@ public class ResteasyReactiveCommonProcessor { private static final String PROVIDERS_SERVICE_FILE = "META-INF/services/" + Providers.class.getName(); private static final Predicate IS_RESTEASY_CLASSIC_CLIENT_DEP = d -> d.getArtifactId() .contains("resteasy-client"); + private static final Predicate IS_RESTEASY_CLASSIC_CORE_DEP = d -> d.getArtifactId() + .equals("resteasy-core"); + private static final Predicate IS_NOT_TEST_SCOPED = d -> !"test".equals(d.getScope()); @Produce(ServiceStartBuildItem.class) @BuildStep void checkMixingStacks(Capabilities capabilities, CurateOutcomeBuildItem curateOutcomeBuildItem) { List resteasyClassicDeps = curateOutcomeBuildItem.getApplicationModel().getDependencies().stream() .filter(d -> d.getGroupId().equals("org.jboss.resteasy")).collect(Collectors.toList()); - boolean hasResteasyCoreDep = resteasyClassicDeps.stream().anyMatch(d -> d.getArtifactId().equals("resteasy-core")); + boolean hasResteasyCoreDep = resteasyClassicDeps.stream() + .anyMatch(IS_NOT_TEST_SCOPED.and(IS_RESTEASY_CLASSIC_CORE_DEP)); if (!hasResteasyCoreDep) { return; } - boolean hasResteasyClassicClient = resteasyClassicDeps.stream().anyMatch(IS_RESTEASY_CLASSIC_CLIENT_DEP); + boolean hasResteasyClassicClient = resteasyClassicDeps.stream() + .anyMatch(IS_NOT_TEST_SCOPED.and(IS_RESTEASY_CLASSIC_CLIENT_DEP)); if (!hasResteasyClassicClient) { // there is no bulletproof way of knowing whether a server specific dependency has been included, so we deduce it by the absence of client dependency throw new DeploymentException("Mixing RESTEasy Reactive and RESTEasy Classic server parts is not supported"); }