diff --git a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/cli/Picocli.java b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/cli/Picocli.java index 879817314e93..b7b2807bb1d7 100644 --- a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/cli/Picocli.java +++ b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/cli/Picocli.java @@ -67,6 +67,7 @@ import org.keycloak.quarkus.runtime.cli.command.ImportRealmMixin; import org.keycloak.quarkus.runtime.cli.command.Main; import org.keycloak.quarkus.runtime.cli.command.ShowConfig; +import org.keycloak.quarkus.runtime.cli.command.Start; import org.keycloak.quarkus.runtime.cli.command.StartDev; import org.keycloak.quarkus.runtime.cli.command.Tools; import org.keycloak.quarkus.runtime.configuration.ConfigArgsConfigSource; @@ -193,6 +194,14 @@ private static boolean shouldSkipRebuild(List cliArgs, String currentCom } private static boolean requiresReAugmentation(CommandLine cmdCommand) { + if (ConfigArgsConfigSource.getAllCliArgs().contains(Start.NAME) + // run time dev mode is not set + && !org.keycloak.common.util.Environment.isDevMode() + // build time dev mode was set + && org.keycloak.common.util.Environment.DEV_PROFILE_VALUE.equals(getBuildTimeProperty(org.keycloak.common.util.Environment.PROFILE).orElse(null))) { + return true; + } + if (hasConfigChanges(cmdCommand)) { if (!ConfigArgsConfigSource.getAllCliArgs().contains(StartDev.NAME) && "dev".equals(getConfig().getOptionalValue("kc.profile", String.class).orElse(null))) { return false; diff --git a/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/StartCommandDistTest.java b/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/StartCommandDistTest.java index 07fa0abde57e..ef36343948bd 100644 --- a/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/StartCommandDistTest.java +++ b/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/StartCommandDistTest.java @@ -158,6 +158,16 @@ void testWarningWhenOverridingBuildOptionsDuringStart(KeycloakDistribution dist) cliResult.assertNoMessage("The previous optimized build will be overridden with the following build options:"); // no message, same values provided during auto-build } + @Test + @RawDistOnly(reason = "Containers are immutable") + void testStartAfterStartDev(KeycloakDistribution dist) { + CLIResult cliResult = dist.run("start-dev"); + cliResult.assertStartedDevMode(); + + cliResult = dist.run("start", "--http-enabled", "true", "--hostname-strict", "false"); + cliResult.assertStarted(); + } + @Test @RawDistOnly(reason = "Containers are immutable") void testWarningWhenOverridingNonCliBuildOptionsDuringStart(KeycloakDistribution dist) {