private Resolved resolve(List<Rule> spec, Set<Dependency> dependencies) {
        var resolvedDeps = new HashSet<Dependency>();
        var resolveRules = new HashSet<Rule>();
        var unmatchedDeps = new HashSet<Dependency>();
        var unmatchedRules = new HashSet<Rule>();
        for (var rule : spec) {
            var requiredDependency = rule.resolveToDependency(project.getProperties());
            if (dependencies.contains(requiredDependency)) {
                resolvedDeps.add(requiredDependency);
                resolveRules.add(rule);
            } else {
                unmatchedRules.add(rule);
            }
        }
        for (var dependency : dependencies) {
            if (!resolvedDeps.contains(dependency)) {
                unmatchedDeps.add(dependency);
            }
        }
        return new Resolved(resolvedDeps, resolveRules, unmatchedDeps, unmatchedRules);
    }
Only return the projects we'd like to enforce dependencies for: the root project, its modules, their modules, etc.
vespa-enforcer-extensions/src/main/java/com/yahoo/vespa/maven/plugin/enforcer/AllowedDependencies.java