Class ArtifactMatcher
java.lang.Object
org.apache.maven.enforcer.rules.utils.ArtifactMatcher
This class is used for matching Artifacts against a list of patterns.
- Author:
- Jakub Senko
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classTo be used for artifacts which are equivalent for the purposes of theArtifactMatcher.static class -
Constructor Summary
ConstructorsConstructorDescriptionArtifactMatcher(Collection<String> excludeStrings, Collection<String> includeStrings) Construct class by providing patterns as strings. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancontainsVersion(org.apache.maven.artifact.versioning.VersionRange allowedRange, org.apache.maven.artifact.versioning.ArtifactVersion version) Copied from Artifact.VersionRange.booleanmatch(org.apache.maven.artifact.Artifact artifact) Check if artifact matches patterns.booleanmatch(org.apache.maven.model.Dependency dependency) Check if dependency matches patterns.
-
Constructor Details
-
ArtifactMatcher
Construct class by providing patterns as strings. Empty strings are ignored.- Parameters:
excludeStrings- includesincludeStrings- excludes- Throws:
NullPointerException- if any of the arguments is null
-
-
Method Details
-
match
Check if artifact matches patterns.- Parameters:
artifact- the artifact to match- Returns:
trueif artifact matches anyexcludePatternsand none of theincludePatterns, otherwisefalse
-
match
Check if dependency matches patterns.- Parameters:
dependency- the dependency to match- Returns:
trueif dependency matches anyexcludePatternsand none of theincludePatterns, otherwisefalse
-
containsVersion
public static boolean containsVersion(org.apache.maven.artifact.versioning.VersionRange allowedRange, org.apache.maven.artifact.versioning.ArtifactVersion version) Copied from Artifact.VersionRange. This is tweaked to handle singular ranges properly. The default containsVersion method assumes a singular version means allow everything. This method assumes that "2.0.4" == "[2.0.4,)"- Parameters:
allowedRange- range of allowed versionsversion- the version to be checked- Returns:
- true if the version is contained by the range
-