Skip to content

Commit 4e31624

Browse files
radcortezgsmet
authored andcommitted
Propagate build properties in the IDE DevModeContext
(cherry picked from commit b0498e6)
1 parent 2bca133 commit 4e31624

File tree

6 files changed

+104
-0
lines changed

6 files changed

+104
-0
lines changed

core/deployment/src/main/java/io/quarkus/deployment/dev/IDEDevModeMain.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import java.util.HashMap;
66
import java.util.LinkedHashSet;
77
import java.util.Map;
8+
import java.util.Properties;
89
import java.util.Set;
910
import java.util.function.BiConsumer;
1011

@@ -37,6 +38,10 @@ public void accept(CuratedApplication curatedApplication, Map<String, Object> st
3738
Path appClasses = (Path) stringObjectMap.get("app-classes");
3839
DevModeContext devModeContext = new DevModeContext();
3940
devModeContext.setArgs((String[]) stringObjectMap.get("args"));
41+
Properties buildSystemProperties = curatedApplication.getQuarkusBootstrap().getBuildSystemProperties();
42+
for (String key : buildSystemProperties.stringPropertyNames()) {
43+
devModeContext.getBuildSystemProperties().put(key, buildSystemProperties.getProperty(key));
44+
}
4045

4146
ApplicationModel appModel = null;
4247
try {

integration-tests/maven/src/test/java/io/quarkus/maven/it/BuildIT.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,12 @@ void testCustomManifestAttributes() throws MavenInvocationException, Interrupted
182182
assertThat(section.getValue("visibility")).isEqualTo("private");
183183
}
184184
}
185+
}
185186

187+
@Test
188+
void testIdeDevModeBuildPropsPropagation() throws MavenInvocationException, InterruptedException, IOException {
189+
testDir = initProject("projects/ide-dev-mode-build-props");
190+
build();
186191
}
187192

188193
private void launch() throws IOException {
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?xml version="1.0"?>
2+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>org.acme</groupId>
6+
<artifactId>acme</artifactId>
7+
<version>1.0-SNAPSHOT</version>
8+
<properties>
9+
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
10+
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
11+
<quarkus.platform.version>@project.version@</quarkus.platform.version>
12+
<quarkus-plugin.version>@project.version@</quarkus-plugin.version>
13+
<compiler-plugin.version>${compiler-plugin.version}</compiler-plugin.version>
14+
<maven.compiler.source>${maven.compiler.source}</maven.compiler.source>
15+
<maven.compiler.target>${maven.compiler.target}</maven.compiler.target>
16+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
17+
</properties>
18+
<dependencyManagement>
19+
<dependencies>
20+
<!-- insert managed dependencies here -->
21+
<dependency>
22+
<groupId>\${quarkus.platform.group-id}</groupId>
23+
<artifactId>\${quarkus.platform.artifact-id}</artifactId>
24+
<version>\${quarkus.platform.version}</version>
25+
<type>pom</type>
26+
<scope>import</scope>
27+
</dependency>
28+
</dependencies>
29+
</dependencyManagement>
30+
<dependencies>
31+
<!-- insert test dependencies here -->
32+
<dependency>
33+
<groupId>io.quarkus</groupId>
34+
<artifactId>quarkus-core</artifactId>
35+
</dependency>
36+
<dependency>
37+
<groupId>io.quarkus</groupId>
38+
<artifactId>quarkus-avro</artifactId>
39+
</dependency>
40+
<dependency>
41+
<groupId>io.quarkus</groupId>
42+
<artifactId>quarkus-container-image-docker</artifactId>
43+
</dependency>
44+
<dependency>
45+
<groupId>io.quarkus</groupId>
46+
<artifactId>quarkus-junit5</artifactId>
47+
<scope>test</scope>
48+
</dependency>
49+
</dependencies>
50+
<build>
51+
<plugins>
52+
<plugin>
53+
<artifactId>maven-compiler-plugin</artifactId>
54+
<version>\${compiler-plugin.version}</version>
55+
</plugin>
56+
<plugin>
57+
<groupId>io.quarkus</groupId>
58+
<artifactId>quarkus-maven-plugin</artifactId>
59+
<version>\${quarkus-plugin.version}</version>
60+
<executions>
61+
<execution>
62+
<goals>
63+
<goal>generate-code</goal>
64+
<goal>generate-code-tests</goal>
65+
<goal>build</goal>
66+
</goals>
67+
</execution>
68+
</executions>
69+
</plugin>
70+
</plugins>
71+
</build>
72+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
quarkus.container-image.labels.app-version=${quarkus.application.version}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package org.acme;
2+
3+
import io.quarkus.launcher.QuarkusLauncher;
4+
import org.junit.jupiter.api.Test;
5+
6+
public class LauncherTest {
7+
@Test
8+
public void testLauncher() throws Exception {
9+
try(var app = QuarkusLauncher.launch(LauncherTest.class.getName(), TestApp.class.getName())) {
10+
}
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package org.acme;
2+
3+
import io.quarkus.runtime.Quarkus;
4+
5+
public class TestApp {
6+
public static void main(String[] args) {
7+
Quarkus.run(args);
8+
}
9+
}

0 commit comments

Comments
 (0)