From f06cac854f44069a0637e40a6ab5596b914af387 Mon Sep 17 00:00:00 2001 From: Michael Keppler Date: Sat, 30 Sep 2023 14:25:55 +0200 Subject: [PATCH] Ignore Tycho generated POMs 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; }