Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant' exclude dependency-reduced-pom.xml #650

Open
philippe-granet opened this issue Nov 9, 2023 · 2 comments
Open

Cant' exclude dependency-reduced-pom.xml #650

philippe-granet opened this issue Nov 9, 2023 · 2 comments
Labels
bug Something isn't working question Further information is requested

Comments

@philippe-granet
Copy link
Contributor

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 philippe-granet added the bug Something isn't working label Nov 9, 2023
@Bananeweizen
Copy link
Contributor

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>

@timtebeek
Copy link
Contributor

timtebeek commented Dec 11, 2023

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

Map<MavenProject, List<Marker>> projectProvenances = mavenSession.getProjects().stream()
.collect(Collectors.toMap(Function.identity(), this::generateProvenance));
Map<MavenProject, Xml.Document> projectMap = parseMaven(mavenSession.getProjects(), projectProvenances, ctx);
return mavenSession.getProjects().stream()

Set<Path> allPoms = new LinkedHashSet<>();
mavenProjects.forEach(p -> collectPoms(p, allPoms));
for (MavenProject mavenProject : mavenProjects) {
mavenSession.getProjectDependencyGraph().getUpstreamProjects(mavenProject, true).forEach(p -> collectPoms(p, allPoms));
}

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 timtebeek added the question Further information is requested label Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
Status: Backlog
Development

No branches or pull requests

3 participants