Skip to content

Commit c834a81

Browse files
committed
Pass app model location to Maven test process
Otherwise it doesn't actually use the app model stored in that location and instead tries to recreate it from the Maven POM files.
1 parent ce76b9e commit c834a81

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
import java.util.function.Consumer;
1010
import java.util.stream.Collectors;
1111

12-
import io.quarkus.bootstrap.BootstrapConstants;
1312
import org.apache.maven.plugin.MojoExecutionException;
1413
import org.apache.maven.plugin.MojoFailureException;
1514
import org.apache.maven.plugins.annotations.LifecyclePhase;
1615
import org.apache.maven.plugins.annotations.Mojo;
1716
import org.apache.maven.plugins.annotations.Parameter;
1817
import org.apache.maven.plugins.annotations.ResolutionScope;
1918

19+
import io.quarkus.bootstrap.BootstrapConstants;
2020
import io.quarkus.bootstrap.app.ApplicationModelSerializer;
2121
import io.quarkus.bootstrap.app.CuratedApplication;
2222
import io.quarkus.bootstrap.classloading.QuarkusClassLoader;
@@ -119,11 +119,16 @@ void generateCode(PathCollection sourceParents, Consumer<Path> sourceRegistrar,
119119
.getSerializedTestAppModelPath(Path.of(mavenProject().getBuild().getDirectory()));
120120
ApplicationModelSerializer.serialize(appModel, serializedTestAppModelPath);
121121

122+
Properties properties = mavenProject().getProperties();
123+
String argLine = properties.getProperty("argLine", "");
124+
properties.setProperty("argLine", argLine +
125+
" -D" + BootstrapConstants.SERIALIZED_TEST_APP_MODEL + "=" + serializedTestAppModelPath);
126+
122127
String deployClasspath = appModel.getDependencies().stream()
123128
.flatMap(dep -> dep.getResolvedPaths().stream())
124129
.map(Path::toString)
125130
.collect(Collectors.joining(File.pathSeparator));
126-
mavenProject().getProperties().setProperty("quarkus.test.deploy.classpath", deployClasspath);
131+
properties.setProperty("quarkus.test.deploy.classpath", deployClasspath);
127132
} catch (IOException e) {
128133
getLog().warn("Failed to serialize application model", e);
129134
}

0 commit comments

Comments
 (0)