Skip to content

Commit f46a43a

Browse files
authored
Merge pull request quarkusio#50602 from oehme/oehme/json-appmodel
Pass app model location to Maven test process
2 parents 2c74b95 + 9a8f8e7 commit f46a43a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

devtools/maven/src/main/java/io/quarkus/maven/GenerateCodeMojo.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import org.apache.maven.plugins.annotations.Parameter;
1515
import org.apache.maven.plugins.annotations.ResolutionScope;
1616

17+
import io.quarkus.bootstrap.BootstrapConstants;
1718
import io.quarkus.bootstrap.app.ApplicationModelSerializer;
1819
import io.quarkus.bootstrap.app.CuratedApplication;
1920
import io.quarkus.bootstrap.classloading.QuarkusClassLoader;
@@ -115,6 +116,13 @@ void generateCode(PathCollection sourceParents, Consumer<Path> sourceRegistrar,
115116
Path serializedTestAppModelPath = BootstrapUtils
116117
.getSerializedTestAppModelPath(Path.of(mavenProject().getBuild().getDirectory()));
117118
ApplicationModelSerializer.serialize(appModel, serializedTestAppModelPath);
119+
120+
//Pass the application model to the Surefire/Failsafe test process as a system property,
121+
//so it doesn't have to do a workspace search to find it. Same as we do for Gradle.
122+
Properties properties = mavenProject().getProperties();
123+
String argLine = properties.getProperty("argLine", "");
124+
properties.setProperty("argLine", argLine +
125+
" -D" + BootstrapConstants.SERIALIZED_TEST_APP_MODEL + "=" + serializedTestAppModelPath);
118126
} catch (IOException e) {
119127
getLog().warn("Failed to serialize application model", e);
120128
}

0 commit comments

Comments
 (0)