private static boolean matches(Artifact dependency, String rule) throws EnforcerRuleException {
        String[] segments = rule.split(":");
        if (segments.length < 4 || segments.length > 6) throw new EnforcerRuleException("Invalid rule: " + rule);
        int index = 0;
        if (!segmentMatches(dependency.getGroupId(), segments[index++])) return false;
        if (!segmentMatches(dependency.getArtifactId(), segments[index++])) return false;
        if (segments.length >= 5) {
            if (!segmentMatches(dependency.getType(), segments[index++])) return false;
        }
        if (segments.length == 6) {
            if (!dependency.hasClassifier() || !segmentMatches(dependency.getClassifier(), segments[index++])) return false;
        } else {
            if (dependency.hasClassifier()) return false;
        }
        if (!versionMatches(dependency.getVersion(), segments[index++])) return false;
        return segmentMatches(dependency.getScope(), segments[index]);
    }
Rules follows same structure as {@link DefaultArtifact#toString} output.
Allowed variants:
- {@code <groupId>:<artifactId>:<version>:<scope>}
- {@code <groupId>:<artifactId>:<type>:<version>:<scope>}
- {@code <groupId>:<artifactId>:<type>:<classifier>:<version>:<scope>}
vespa-enforcer-extensions/src/main/java/com/yahoo/vespa/maven/plugin/enforcer/EnforceDependencies.java