diff --git a/devtools/maven/src/main/java/io/quarkus/maven/DependencyTreeMojo.java b/devtools/maven/src/main/java/io/quarkus/maven/DependencyTreeMojo.java index 38a5e0e5aa588..261d7bcee4288 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/DependencyTreeMojo.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/DependencyTreeMojo.java @@ -147,8 +147,9 @@ private void logTree(final Consumer log) throws MojoExecutionException { "Parameter 'mode' was set to '" + mode + "' while expected one of 'dev', 'test' or 'prod'"); } } + // enable the incubating model resolver impl by default for this mojo modelResolver.setIncubatingModelResolver( - IncubatingApplicationModelResolver.isIncubatingEnabled(project.getProperties())); + !IncubatingApplicationModelResolver.isIncubatingModelResolverProperty(project.getProperties(), "false")); modelResolver.setDepLogConfig(DependencyLoggingConfig.builder() .setMessageConsumer(log) .setVerbose(verbose) diff --git a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java index 696742ca1e9da..931071b77c48e 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java @@ -1361,7 +1361,9 @@ private QuarkusDevModeLauncher newLauncher(Boolean debugPortOk, String bootstrap .setDevMode(true) .setTest(LaunchMode.TEST.equals(getLaunchModeClasspath())) .setCollectReloadableDependencies(!noDeps) - .setIncubatingModelResolver(IncubatingApplicationModelResolver.isIncubatingEnabled(project.getProperties())) + // enabled the incubating model resolver for in dev mode + .setIncubatingModelResolver(!IncubatingApplicationModelResolver + .isIncubatingModelResolverProperty(project.getProperties(), "false")) .resolveModel(mvnCtx.getCurrentProject().getAppArtifact()); } diff --git a/devtools/maven/src/main/java/io/quarkus/maven/QuarkusBootstrapProvider.java b/devtools/maven/src/main/java/io/quarkus/maven/QuarkusBootstrapProvider.java index f23488af36c87..56eff8bfba092 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/QuarkusBootstrapProvider.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/QuarkusBootstrapProvider.java @@ -216,7 +216,10 @@ private CuratedApplication doBootstrap(QuarkusBootstrapMojo mojo, LaunchMode mod final BootstrapAppModelResolver modelResolver = new BootstrapAppModelResolver(artifactResolver(mojo, mode)) .setIncubatingModelResolver( - IncubatingApplicationModelResolver.isIncubatingEnabled(mojo.mavenProject().getProperties())) + IncubatingApplicationModelResolver.isIncubatingEnabled(mojo.mavenProject().getProperties()) + || mode == LaunchMode.DEVELOPMENT + && !IncubatingApplicationModelResolver.isIncubatingModelResolverProperty( + mojo.mavenProject().getProperties(), "false")) .setDevMode(mode == LaunchMode.DEVELOPMENT) .setTest(mode == LaunchMode.TEST) .setCollectReloadableDependencies(mode == LaunchMode.DEVELOPMENT || mode == LaunchMode.TEST); diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/menu/DependenciesProcessor.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/menu/DependenciesProcessor.java index 3065d06b4cb29..5708cb57c99e5 100644 --- a/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/menu/DependenciesProcessor.java +++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/menu/DependenciesProcessor.java @@ -12,7 +12,6 @@ import java.util.Set; import java.util.TreeSet; -import org.eclipse.microprofile.config.Config; import org.eclipse.microprofile.config.ConfigProvider; import io.quarkus.bootstrap.model.ApplicationModel; @@ -83,8 +82,9 @@ void createBuildTimeActions(BuildProducer buildTimeAct } private boolean isEnabled() { - Config c = ConfigProvider.getConfig(); - return c.getValue("quarkus.bootstrap.incubating-model-resolver", Boolean.class); + var value = ConfigProvider.getConfig().getConfigValue("quarkus.bootstrap.incubating-model-resolver"); + // if it's not false and if it's false it doesn't come from the default value + return value == null || !"false".equals(value.getValue()) || "default values".equals(value.getSourceName()); } private void buildTree(ApplicationModel model, Root root, Optional> allGavs, Optional toTarget) { diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java index b89b39355fcc0..a748ea5a4b732 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java @@ -13,6 +13,7 @@ import java.util.Collection; import java.util.HashSet; import java.util.List; +import java.util.Properties; import java.util.Set; import org.jboss.logging.Logger; @@ -172,11 +173,12 @@ private BootstrapAppModelResolver initAppModelResolver(MavenArtifactResolver art .setDevMode(devMode); var project = artifactResolver.getMavenContext().getCurrentProject(); if (project != null) { - appModelResolver.setIncubatingModelResolver( - IncubatingApplicationModelResolver.isIncubatingEnabled( - project.getModelBuildingResult() == null - ? project.getRawModel().getProperties() - : project.getModelBuildingResult().getEffectiveModel().getProperties())); + final Properties modelProps = project.getModelBuildingResult() == null + ? project.getRawModel().getProperties() + : project.getModelBuildingResult().getEffectiveModel().getProperties(); + appModelResolver.setIncubatingModelResolver(IncubatingApplicationModelResolver.isIncubatingEnabled(modelProps) + || devMode + && !IncubatingApplicationModelResolver.isIncubatingModelResolverProperty(modelProps, "false")); } return appModelResolver; } diff --git a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/IncubatingApplicationModelResolver.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/IncubatingApplicationModelResolver.java index 118d9a4ab4390..b50939b6727b7 100644 --- a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/IncubatingApplicationModelResolver.java +++ b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/IncubatingApplicationModelResolver.java @@ -19,6 +19,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Properties; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedDeque; @@ -82,15 +83,44 @@ public class IncubatingApplicationModelResolver { /** * Temporary method that will be removed once this implementation becomes the default. + *

+ * Returns {@code true} if system or POM property {@code quarkus.bootstrap.incubating-model-resolver} + * is set to {@code true}. * * @return true if this implementation is enabled */ public static boolean isIncubatingEnabled(Properties projectProperties) { + return Boolean.parseBoolean(getIncubatingModelResolverProperty(projectProperties)); + } + + /** + * Temporary method that will be removed once this implementation becomes the default. + *

+ * Calls {@link #getIncubatingModelResolverProperty(Properties)} and checks whether the returned value + * equals the passed in {@code value}. + * + * @return true if value of quarkus.bootstrap.incubating-model-resolver property is equal to the passed in value + */ + public static boolean isIncubatingModelResolverProperty(Properties projectProperties, String value) { + Objects.requireNonNull(value); + return value.equals(getIncubatingModelResolverProperty(projectProperties)); + } + + /** + * Temporary method that will be removed once this implementation becomes the default. + *

+ * Returns value of system or POM property {@code quarkus.bootstrap.incubating-model-resolver}. + * The system property is checked first and if its value is not {@code null}, it's returned. + * Otherwise, the value of POM property is returned as the result. + * + * @return value of system or POM property quarkus.bootstrap.incubating-model-resolver or null if it's not set + */ + public static String getIncubatingModelResolverProperty(Properties projectProperties) { var value = System.getProperty(INCUBATING_MODEL_RESOLVER); - if (value == null && projectProperties != null) { - value = String.valueOf(projectProperties.get(INCUBATING_MODEL_RESOLVER)); + if (value != null || projectProperties == null) { + return value; } - return Boolean.parseBoolean(value); + return String.valueOf(projectProperties.get(INCUBATING_MODEL_RESOLVER)); } public static IncubatingApplicationModelResolver newInstance() {