From a482eff78c7bcd86ca5475e9a3f58e090f8e9841 Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Wed, 28 Feb 2024 01:19:34 +0100 Subject: [PATCH] Add Maven BuildTool marker to .mvn/maven.config (#746) --- .../java/org/openrewrite/maven/MavenMojoProjectParser.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/openrewrite/maven/MavenMojoProjectParser.java b/src/main/java/org/openrewrite/maven/MavenMojoProjectParser.java index 9ca8bdc2..2140c106 100644 --- a/src/main/java/org/openrewrite/maven/MavenMojoProjectParser.java +++ b/src/main/java/org/openrewrite/maven/MavenMojoProjectParser.java @@ -88,6 +88,7 @@ // ----------------------------------------------------------------------------------------------------------------- public class MavenMojoProjectParser { + private static final String MVN_MAVEN_CONFIG = ".mvn/maven.config"; @Nullable public static MavenPomCache POM_CACHE; @@ -202,8 +203,9 @@ public Stream listSourceFiles(MavenProject mavenProject, @Nullable X .map(addProvenance(baseDir, projectProvenance, null)); logDebug(mavenProject, "Parsed " + (alreadyParsed.size() - sourcesParsedBefore) + " additional files found within the project."); } else { - // Only parse Maven wrapper files, such that UpdateMavenWrapper can use the version information. + // Only parse Maven wrapper related files, such that UpdateMavenWrapper can use the version information. parsedResourceFiles = Stream.of( + Paths.get(MVN_MAVEN_CONFIG), MavenWrapper.WRAPPER_BATCH_LOCATION, MavenWrapper.WRAPPER_JAR_LOCATION, MavenWrapper.WRAPPER_PROPERTIES_LOCATION, @@ -533,7 +535,7 @@ public Map parseMaven(List mavenProjec for (MavenProject mavenProject : mavenProjects) { mavenSession.getProjectDependencyGraph().getUpstreamProjects(mavenProject, true).forEach(p -> collectPoms(p, allPoms)); } - MavenParser.Builder mavenParserBuilder = MavenParser.builder().mavenConfig(baseDir.resolve(".mvn/maven.config")); + MavenParser.Builder mavenParserBuilder = MavenParser.builder().mavenConfig(baseDir.resolve(MVN_MAVEN_CONFIG)); MavenSettings settings = buildSettings(); MavenExecutionContextView mavenExecutionContext = MavenExecutionContextView.view(ctx);