From 12ff85a674761cd11851825bc6d0d0c098969f03 Mon Sep 17 00:00:00 2001 From: Michael Keppler Date: Sun, 1 Oct 2023 10:54:45 +0200 Subject: [PATCH] Ignore Tycho generated POMs (#635) Eclipse Tycho produces artificial Maven POMs during the build, which should be ignored by the POM scanner. Fixes #634. --- .../org/openrewrite/maven/MavenMojoProjectParser.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/org/openrewrite/maven/MavenMojoProjectParser.java b/src/main/java/org/openrewrite/maven/MavenMojoProjectParser.java index daf59b34..5dc54482 100644 --- a/src/main/java/org/openrewrite/maven/MavenMojoProjectParser.java +++ b/src/main/java/org/openrewrite/maven/MavenMojoProjectParser.java @@ -494,6 +494,14 @@ private static Path pomPath(MavenProject mavenProject) { if (pomPath.endsWith(".flattened-pom.xml")) { return mavenProject.getBasedir().toPath().resolve("pom.xml"); } + // org.eclipse.tycho:tycho-packaging-plugin:update-consumer-pom produces a synthetic pom + if (pomPath.endsWith(".tycho-consumer-pom.xml")) { + Path normalPom = mavenProject.getBasedir().toPath().resolve("pom.xml"); + // check for existence of the POM, since Tycho can work pom-less + if (Files.isReadable(normalPom) && Files.isRegularFile(normalPom)) { + return normalPom; + } + } return pomPath; }