diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/ApplicationInfoBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/ApplicationInfoBuildStep.java index 116a48df2..04202643e 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/steps/ApplicationInfoBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/ApplicationInfoBuildStep.java @@ -1,8 +1,8 @@ package io.quarkus.deployment.steps; -import io.quarkus.deployment.ApplicationConfig; import io.quarkus.deployment.annotations.BuildStep; import io.quarkus.deployment.builditem.ApplicationInfoBuildItem; +import io.quarkus.runtime.ApplicationConfig; public class ApplicationInfoBuildStep { diff --git a/core/deployment/src/main/java/io/quarkus/runner/RuntimeRunner.java b/core/deployment/src/main/java/io/quarkus/runner/RuntimeRunner.java index cbb42ff10..1f81788a8 100644 --- a/core/deployment/src/main/java/io/quarkus/runner/RuntimeRunner.java +++ b/core/deployment/src/main/java/io/quarkus/runner/RuntimeRunner.java @@ -97,6 +97,7 @@ public class RuntimeRunner implements Runnable, Closeable { builder.setRoot(target); builder.setClassLoader(loader); builder.setLaunchMode(launchMode); + builder.setBuildSystemProperties(buildSystemProperties); if (liveReloadState != null) { builder.setLiveReloadState(liveReloadState); } diff --git a/core/deployment/src/main/java/io/quarkus/deployment/ApplicationConfig.java b/core/runtime/src/main/java/io/quarkus/runtime/ApplicationConfig.java similarity index 59% rename from core/deployment/src/main/java/io/quarkus/deployment/ApplicationConfig.java rename to core/runtime/src/main/java/io/quarkus/runtime/ApplicationConfig.java index e43025961..a8148e17c 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/ApplicationConfig.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/ApplicationConfig.java @@ -1,4 +1,4 @@ -package io.quarkus.deployment; +package io.quarkus.runtime; import java.util.Optional; @@ -6,19 +6,19 @@ import io.quarkus.runtime.annotations.ConfigItem; import io.quarkus.runtime.annotations.ConfigPhase; import io.quarkus.runtime.annotations.ConfigRoot; -@ConfigRoot(phase = ConfigPhase.BUILD_TIME) +@ConfigRoot(phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED) public class ApplicationConfig { /** * The name of the application. - * If not set, defaults to the name of the project. + * If not set, defaults to the name of the project (except for tests where it is not set at all). */ @ConfigItem public Optional name; /** * The version of the application. - * If not set, defaults to the version of the project + * If not set, defaults to the version of the project (except for tests where it is not set at all). */ @ConfigItem public Optional version; 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 4243d6c1e..f0ee42197 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java @@ -490,7 +490,13 @@ public class DevMojo extends AbstractMojo { for (Map.Entry e : System.getProperties().entrySet()) { devModeContext.getSystemProperties().put(e.getKey().toString(), (String) e.getValue()); } + devModeContext.getBuildSystemProperties().putAll((Map) project.getProperties()); + + // this is a minor hack to allow ApplicationConfig to be populated with defaults + devModeContext.getBuildSystemProperties().putIfAbsent("quarkus.application.name", project.getArtifactId()); + devModeContext.getBuildSystemProperties().putIfAbsent("quarkus.application.version", project.getVersion()); + devModeContext.setSourceEncoding(getSourceEncoding()); devModeContext.setSourceJavaVersion(source); devModeContext.setTargetJvmVersion(target);