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

[MSHADE-148] Don't attach exclusions that are already present #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[MSHADE-148] Don't attach exclusions that are already present
Although I don't fully understand the scenarios where we re-evaluate
the exclusions of a dependency, I do know that if we do, we will add
them again, leading to a false indication that the dependency list has
changed, leading to a regeneration and re-evaluation of the list,
which then continues indefinitely, as the the same exclusions are
added again and again.

To address the leaf problem, let's ensure that we never add an
exclusion that is already present. That way, even if reevaluation
occurs, it will not result in changes.
Philip Langdale committed Mar 5, 2019
commit acfb2068fe945682e96a4f9bb460ce42f30ab465
14 changes: 11 additions & 3 deletions src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java
Original file line number Diff line number Diff line change
@@ -1178,9 +1178,17 @@ public boolean updateExcludesInDeps( MavenProject project, List<Dependency> depe
Exclusion exclusion = new Exclusion();
exclusion.setArtifactId( n3.getArtifact().getArtifactId() );
exclusion.setGroupId( n3.getArtifact().getGroupId() );
dep.addExclusion( exclusion );
modified = true;
break;
// only add an exclusion if it's not already present.
for ( Exclusion ex : dep.getExclusions() )
{
if ( !ex.getArtifactId().equals( exclusion.getArtifactId() )
|| !ex.getGroupId().equals( exclusion.getGroupId() ) )
{
dep.addExclusion( exclusion );
modified = true;
break;
}
}
}
}
}