mirror of
https://github.com/apache/maven.git
synced 2025-02-21 01:15:42 +00:00
[MNG-6760] ExclusionArtifactFilter result invalid when wildcard exclusion is followed by other exclusions
This commit is contained in:
parent
71eafc4d68
commit
3eb242c571
@ -47,16 +47,18 @@ public boolean include( Artifact artifact )
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
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 void testExcludeAllWildcard()
|
||||
|
||||
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 ) );
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user