public POMInfo searchMatchingPOM(Dependency dependency) {
        if (dependency == null) {
            return null;
        }
        
        POMInfo pom = getPOM(dependency);
        if (pom != null) {
            return pom;
        }

        Map<DependencyRule, POMInfo> potentialMatches = new TreeMap<DependencyRule, POMInfo>();
        for (POMInfo testPom : getAllPoms()) {
            Set<DependencyRule> rules = testPom.getPublishedRules();
            rules.add(MAVEN_PLUGINS_KEEP_VERSION_RULE);
            rules.add(TO_DEBIAN_VERSION_RULE);
            
            for (DependencyRule rule : rules) {
                if (rule.matches(dependency) && rule.apply(dependency).equals(testPom.getThisPom())) {
                    potentialMatches.put(rule, testPom);
                }
            }
        }
        if (!potentialMatches.isEmpty()) {
            // Return the best match
            return potentialMatches.values().iterator().next();
        }
        return null;
    }