rewrite-maven-plugin icon indicating copy to clipboard operation
rewrite-maven-plugin copied to clipboard

Cant' exclude dependency-reduced-pom.xml

Open philippe-granet opened this issue 2 years ago • 2 comments

What version of OpenRewrite are you using?

I am using

  • OpenRewrite v8.8.4
  • Maven plugin v5.10.0

How are you running OpenRewrite?

I am using the Maven plugin, and my project is a single module project.

<plugin>
  <groupId>org.openrewrite.maven</groupId>
  <artifactId>rewrite-maven-plugin</artifactId>
  <version>8.8.4</version>
</plugin>

What is the smallest, simplest way to reproduce the problem?

Use Maven Shade plugin and add dependency-reduced-pom.xml to excluded files (-Drewrite.exclusions=dependency-reduced-pom.xml)

What did you expect to see?

No patch generated for dependency-reduced-pom.xml

What did you see instead?

Patch generated for dependency-reduced-pom.xml

philippe-granet avatar Nov 09 '23 14:11 philippe-granet

I've also not been able to use exclusions successfully. I have this configuration to match folders like src-gen and similar, but generated files are still modified:

<exclusions>
	<!-- generated code -->
	<exclusion>**/*-gen/**</exclusion>
</exclusions>

Bananeweizen avatar Nov 16 '23 07:11 Bananeweizen

Hmm; the reason for this will be that we ask Maven what files to process, and likely this is one of the files returned.

https://github.com/openrewrite/rewrite-maven-plugin/blob/d1b68cdce46e9dfc2efa6fd133d2873ddf08e8ce/src/main/java/org/openrewrite/maven/MavenMojoProjectParser.java#L150-L153 https://github.com/openrewrite/rewrite-maven-plugin/blob/d1b68cdce46e9dfc2efa6fd133d2873ddf08e8ce/src/main/java/org/openrewrite/maven/MavenMojoProjectParser.java#L463-L467

The Maven shade plugin dependency-reduced-pom.xml has bitten me in the past as well, but went away when I added -DuseDependencyReducedPomInJar=false. Does that work for you as well @philippe-granet ?

timtebeek avatar Dec 11 '23 21:12 timtebeek