private static void checkUnusedDependencies(final String arg) throws Exception {
        var libraries = new HashSet<String>();
        var dependencies = readFile(Paths.get(arg + "/gradle/dependencies.gradle"));
        var matcher = Pattern.compile("\\s*(\\w+)\\s+:\\s").matcher(dependencies);
        while (matcher.find()) {
            libraries.add(matcher.group(1));
        }
        print("Total dependencies: " + libraries.size());
        Files.walk(Paths.get(arg))
            .filter(file -> Files.isRegularFile(file) && file.toFile().getName().endsWith(".gradle"))
            .forEach(file -> {
                if (!libraries.isEmpty()) {
                    var text = readFile(file);
                    libraries.removeIf(lib -> text.contains("libraries." + lib));
                }
            });
        if (!libraries.isEmpty()) {
            print("Found unused dependencies: " + String.join(", ", libraries));
            System.exit(1);
        }
    }
This is {@link CheckDuplicateGradleConfiguration}.

@author Misagh Moayyed
@since 7.1.0
ci/checks/CheckDuplicateGradleConfiguration.java