diff --git a/devtools/maven/src/main/java/io/quarkus/maven/QuarkusBootstrapMojo.java b/devtools/maven/src/main/java/io/quarkus/maven/QuarkusBootstrapMojo.java
index 1af17c8a29623..84dde86e3ad01 100644
--- a/devtools/maven/src/main/java/io/quarkus/maven/QuarkusBootstrapMojo.java
+++ b/devtools/maven/src/main/java/io/quarkus/maven/QuarkusBootstrapMojo.java
@@ -3,6 +3,7 @@
import java.io.File;
import java.util.List;
+import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
@@ -47,6 +48,9 @@ public abstract class QuarkusBootstrapMojo extends AbstractMojo {
@Parameter(defaultValue = "${project}", readonly = true, required = true)
private MavenProject project;
+ @Parameter(defaultValue = "${session}", readonly = true)
+ private MavenSession session;
+
@Parameter(defaultValue = "${project.build.directory}")
private File buildDir;
@@ -125,6 +129,10 @@ protected MavenProject mavenProject() {
return project;
}
+ public MavenSession mavenSession() {
+ return session;
+ }
+
protected File buildDir() {
return buildDir;
}
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 c827cd3f450b3..1717e65b7f3b6 100644
--- a/devtools/maven/src/main/java/io/quarkus/maven/QuarkusBootstrapProvider.java
+++ b/devtools/maven/src/main/java/io/quarkus/maven/QuarkusBootstrapProvider.java
@@ -1,5 +1,8 @@
package io.quarkus.maven;
+import static io.smallrye.common.expression.Expression.Flag.LENIENT_SYNTAX;
+import static io.smallrye.common.expression.Expression.Flag.NO_TRIM;
+
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
@@ -25,6 +28,7 @@
import io.quarkus.bootstrap.model.PathsCollection;
import io.quarkus.bootstrap.resolver.maven.BootstrapMavenException;
import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver;
+import io.smallrye.common.expression.Expression;
@Component(role = QuarkusBootstrapProvider.class, instantiationStrategy = "singleton")
public class QuarkusBootstrapProvider implements Closeable {
@@ -163,6 +167,22 @@ protected QuarkusBootstrap bootstrapQuarkus(QuarkusBootstrapMojo mojo) throws Mo
effectiveProperties.putIfAbsent("quarkus.application.name", mojo.mavenProject().getArtifactId());
effectiveProperties.putIfAbsent("quarkus.application.version", mojo.mavenProject().getVersion());
+ // Add other properties that may be required for expansion
+ for (Object value : effectiveProperties.values()) {
+ for (String reference : Expression.compile((String) value, LENIENT_SYNTAX, NO_TRIM).getReferencedStrings()) {
+ String referenceValue = mojo.mavenSession().getUserProperties().getProperty(reference);
+ if (referenceValue != null) {
+ effectiveProperties.setProperty(reference, referenceValue);
+ continue;
+ }
+
+ referenceValue = projectProperties.getProperty(reference);
+ if (referenceValue != null) {
+ effectiveProperties.setProperty(reference, referenceValue);
+ }
+ }
+ }
+
QuarkusBootstrap.Builder builder = QuarkusBootstrap.builder()
.setAppArtifact(projectArtifact(mojo))
.setMavenArtifactResolver(artifactResolver(mojo))
diff --git a/integration-tests/maven/src/test/java/io/quarkus/maven/it/DevMojoIT.java b/integration-tests/maven/src/test/java/io/quarkus/maven/it/DevMojoIT.java
index eb3bf674d8369..cd1611ab19758 100644
--- a/integration-tests/maven/src/test/java/io/quarkus/maven/it/DevMojoIT.java
+++ b/integration-tests/maven/src/test/java/io/quarkus/maven/it/DevMojoIT.java
@@ -1028,4 +1028,12 @@ public void testThatGenerateCodeGoalIsNotTriggeredIfNotConfigured() throws IOExc
assertThat(running.log()).contains("Copying 1 resource"); // maven-resource-plugin
assertThat(running.log()).contains("Compiling 2 source files"); // maven-compiler-plugin
}
+
+ @Test
+ public void testPropertyExpansion() throws IOException, MavenInvocationException {
+ testDir = initProject("projects/property-expansion");
+ runAndCheck();
+ assertThat(DevModeTestUtils.getHttpResponse("/app/hello/")).isEqualTo("hello");
+ assertThat(DevModeTestUtils.getHttpResponse("/app/hello/applicationName")).isEqualTo("myapp");
+ }
}
diff --git a/integration-tests/maven/src/test/resources/projects/property-expansion/pom.xml b/integration-tests/maven/src/test/resources/projects/property-expansion/pom.xml
new file mode 100644
index 0000000000000..988a9ecb6ff89
--- /dev/null
+++ b/integration-tests/maven/src/test/resources/projects/property-expansion/pom.xml
@@ -0,0 +1,103 @@
+
+
Congratulations, you have created a new Quarkus application.
+ +This page is served by Quarkus. The source is in
+ src/main/resources/META-INF/resources/index.html
.
If not already done, run the application in dev mode using: mvn compile quarkus:dev
.
+
src/main/java
.src/main/resources/META-INF/resources
.src/main/resources/application.properties
.
+ Go give it a star on GitHub.
+ +Just delete the src/main/resources/META-INF/resources/index.html
file.