Skip to content

Commit

Permalink
Ignore generated pom by maven-shade-plugin and ci-friendly-flatten-ma…
Browse files Browse the repository at this point in the history
…ven-plugin (#908)

* Ignore generated pom by maven-shade-plugin and ci-friendly-flatten-maven-plugin

* Collapse handling into a single `if`

---------

Co-authored-by: Tim te Beek <tim@moderne.io>
  • Loading branch information
philippe-granet and timtebeek authored Dec 7, 2024
1 parent 127c1d2 commit ab0ed4b
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/main/java/org/openrewrite/maven/MavenMojoProjectParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -646,12 +646,10 @@ private void collectPoms(MavenProject project, Set<Path> paths, MavenExecutionCo

private static Path pomPath(MavenProject mavenProject) {
Path pomPath = mavenProject.getFile().toPath();
// org.codehaus.mojo:flatten-maven-plugin produces a synthetic pom unsuitable for our purposes, use the regular pom instead
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")) {
if (pomPath.endsWith(".flattened-pom.xml") ||// org.codehaus.mojo:flatten-maven-plugin
pomPath.endsWith("dependency-reduced-pom.xml") || // org.apache.maven.plugins:maven-shade-plugin
pomPath.endsWith(".ci-friendly-pom.xml") || // com.outbrain.swinfra:ci-friendly-flatten-maven-plugin
pomPath.endsWith(".tycho-consumer-pom.xml")) { // org.eclipse.tycho:tycho-packaging-plugin:update-consumer-pom
Path normalPom = mavenProject.getBasedir().toPath().resolve("pom.xml");
// check for the existence of the POM, since Tycho can work pom-less
if (Files.isReadable(normalPom) && Files.isRegularFile(normalPom)) {
Expand Down

0 comments on commit ab0ed4b

Please sign in to comment.