From 41ae1b3a8024ef8c4357e21e05915b288b05da56 Mon Sep 17 00:00:00 2001 From: George Gastaldi Date: Tue, 28 May 2024 11:17:37 -0300 Subject: [PATCH 1/2] Set the target file in the Model This is necessary so `maven-model-helper` can know which pom.xml the change refers to. - Fixes #40853 --- .../bootstrap/resolver/maven/workspace/ModelUtils.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/ModelUtils.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/ModelUtils.java index 97f6c8f1456d4..556407a142017 100644 --- a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/ModelUtils.java +++ b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/ModelUtils.java @@ -232,7 +232,9 @@ private static Properties loadPomProps(Path appJar, Path artifactIdPath) throws } public static Model readModel(final Path pomXml) throws IOException { - return readModel(Files.newInputStream(pomXml)); + Model model = readModel(Files.newInputStream(pomXml)); + model.setPomFile(pomXml.toFile()); + return model; } public static Model readModel(InputStream stream) throws IOException { From 5a65e49a58227cefb4346ae9573b60fdaa67e23b Mon Sep 17 00:00:00 2001 From: George Gastaldi Date: Wed, 29 May 2024 10:24:00 -0300 Subject: [PATCH 2/2] Use MojoUtils.readPom to read POM - As discussed in https://github.com/quarkusio/quarkus/pull/40869/files/2bb3087a2d14fdcf807d3d7e80d83c9a753a8929#r1617860660 --- .../devtools/project/buildfile/MavenProjectBuildFile.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/MavenProjectBuildFile.java b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/MavenProjectBuildFile.java index cc0a2169469c6..8cecb28fedae0 100644 --- a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/MavenProjectBuildFile.java +++ b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/MavenProjectBuildFile.java @@ -381,7 +381,7 @@ protected void refreshData() { return; } try { - model = ModelUtils.readModel(projectPom); + model = MojoUtils.readPom(projectPom.toFile()); } catch (IOException e) { throw new RuntimeException("Failed to read " + projectPom, e); }