Class ArtifactMatcher


  • public final class ArtifactMatcher
    extends java.lang.Object
    This class is used for matching Artifacts against a list of patterns.
    See Also:
    BanTransitiveDependencies
    • Constructor Summary

      Constructors 
      Constructor Description
      ArtifactMatcher​(java.util.Collection<java.lang.String> patterns, java.util.Collection<java.lang.String> ignorePatterns)
      Construct class by providing patterns as strings.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean match​(org.apache.maven.artifact.Artifact artifact)
      Check if artifact matches patterns.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ArtifactMatcher

        public ArtifactMatcher​(java.util.Collection<java.lang.String> patterns,
                               java.util.Collection<java.lang.String> ignorePatterns)
        Construct class by providing patterns as strings. Empty strings are ignored.
        Parameters:
        patterns - includes
        ignorePatterns - excludes
        Throws:
        java.lang.NullPointerException - if any of the arguments is null
    • Method Detail

      • match

        public boolean match​(org.apache.maven.artifact.Artifact artifact)
                      throws org.apache.maven.artifact.versioning.InvalidVersionSpecificationException
        Check if artifact matches patterns.
        Parameters:
        artifact - the artifact to match
        Returns:
        true if artifact matches any patterns and none of the ignorePatterns, otherwise false
        Throws:
        org.apache.maven.artifact.versioning.InvalidVersionSpecificationException - if any pattern contains an invalid version range