You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2019/09/07 12:24:30 UTC
[maven] branch MNG-6760 created (now 3eb242c)
This is an automated email from the ASF dual-hosted git repository.
rfscholte pushed a change to branch MNG-6760
in repository https://gitbox.apache.org/repos/asf/maven.git.
at 3eb242c [MNG-6760] ExclusionArtifactFilter result invalid when wildcard exclusion is followed by other exclusions
This branch includes the following new commits:
new 3eb242c [MNG-6760] ExclusionArtifactFilter result invalid when wildcard exclusion is followed by other exclusions
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[maven] 01/01: [MNG-6760] ExclusionArtifactFilter result invalid
when wildcard exclusion is followed by other exclusions
Posted by rf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rfscholte pushed a commit to branch MNG-6760
in repository https://gitbox.apache.org/repos/asf/maven.git
commit 3eb242c57165cf7786db9e6a9fbfc790912fa2e2
Author: rfscholte <rf...@apache.org>
AuthorDate: Sat Sep 7 14:24:21 2019 +0200
[MNG-6760] ExclusionArtifactFilter result invalid when wildcard exclusion is followed by other exclusions
---
.../resolver/filter/ExclusionArtifactFilter.java | 14 +++++----
.../filter/ExclusionArtifactFilterTest.java | 33 ++++++++++++++++++++++
2 files changed, 41 insertions(+), 6 deletions(-)
diff --git a/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/ExclusionArtifactFilter.java b/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/ExclusionArtifactFilter.java
index e0c9994..dd50c31 100644
--- a/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/ExclusionArtifactFilter.java
+++ b/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/ExclusionArtifactFilter.java
@@ -47,16 +47,18 @@ public class ExclusionArtifactFilter implements ArtifactFilter
{
return false;
}
- if ( WILDCARD.equals( exclusion.getGroupId() ) )
+ if ( WILDCARD.equals( exclusion.getGroupId() )
+ && exclusion.getArtifactId().equals( artifact.getArtifactId() ) )
{
- return !exclusion.getArtifactId().equals( artifact.getArtifactId() );
+ return false;
}
- if ( WILDCARD.equals( exclusion.getArtifactId() ) )
+ if ( WILDCARD.equals( exclusion.getArtifactId() )
+ && exclusion.getGroupId().equals( artifact.getGroupId() ) )
{
- return !exclusion.getGroupId().equals( artifact.getGroupId() );
+ return false;
}
- if ( exclusion.getGroupId().equals( artifact.getGroupId() ) && exclusion.getArtifactId().equals(
- artifact.getArtifactId() ) )
+ if ( exclusion.getGroupId().equals( artifact.getGroupId() )
+ && exclusion.getArtifactId().equals( artifact.getArtifactId() ) )
{
return false;
}
diff --git a/maven-core/src/test/java/org/apache/maven/artifact/resolver/filter/ExclusionArtifactFilterTest.java b/maven-core/src/test/java/org/apache/maven/artifact/resolver/filter/ExclusionArtifactFilterTest.java
index 62a4911..53b6aad 100644
--- a/maven-core/src/test/java/org/apache/maven/artifact/resolver/filter/ExclusionArtifactFilterTest.java
+++ b/maven-core/src/test/java/org/apache/maven/artifact/resolver/filter/ExclusionArtifactFilterTest.java
@@ -24,6 +24,7 @@ import org.apache.maven.model.Exclusion;
import org.junit.Before;
import org.junit.Test;
+import java.util.Arrays;
import java.util.Collections;
import static org.hamcrest.CoreMatchers.is;
@@ -120,4 +121,36 @@ public class ExclusionArtifactFilterTest
assertThat( filter.include( artifact ), is( false ) );
}
+
+ @Test
+ public void testMultipleExclusionsExcludeArtifactIdWildcard()
+ {
+ Exclusion exclusion1 = new Exclusion();
+ exclusion1.setGroupId( "org.apache.groovy" );
+ exclusion1.setArtifactId( "*" );
+
+ Exclusion exclusion2 = new Exclusion();
+ exclusion2.setGroupId( "org.apache.maven" );
+ exclusion2.setArtifactId( "maven-core" );
+
+ ExclusionArtifactFilter filter = new ExclusionArtifactFilter( Arrays.asList( exclusion1, exclusion2 ) );
+
+ assertThat( filter.include( artifact ), is( false ) );
+ }
+
+ @Test
+ public void testMultipleExclusionsExcludeGroupIdWildcard()
+ {
+ Exclusion exclusion1 = new Exclusion();
+ exclusion1.setGroupId( "*" );
+ exclusion1.setArtifactId( "maven-model" );
+
+ Exclusion exclusion2 = new Exclusion();
+ exclusion2.setGroupId( "org.apache.maven" );
+ exclusion2.setArtifactId( "maven-core" );
+
+ ExclusionArtifactFilter filter = new ExclusionArtifactFilter( Arrays.asList( exclusion1, exclusion2 ) );
+
+ assertThat( filter.include( artifact ), is( false ) );
+ }
}
\ No newline at end of file