String dependencyChanges()

in src/main/java/org/apache/maven/plugin/compiler/IncrementalBuild.java [635:673]


    String dependencyChanges(Iterable<List<Path>> dependencies, Collection<String> fileExtensions) throws IOException {
        if (!cacheLoaded) {
            loadCache();
        }
        final FileTime changeTime = FileTime.fromMillis(previousBuildTime);
        final var updated = new ArrayList<Path>();
        for (List<Path> roots : dependencies) {
            for (Path root : roots) {
                try (Stream<Path> files = Files.walk(root)) {
                    files.filter((f) -> {
                                String name = f.getFileName().toString();
                                int s = name.lastIndexOf('.');
                                if (s < 0 || !fileExtensions.contains(name.substring(s + 1))) {
                                    return false;
                                }
                                try {
                                    return Files.isRegularFile(f)
                                            && Files.getLastModifiedTime(f).compareTo(changeTime) >= 0;
                                } catch (IOException e) {
                                    throw new UncheckedIOException(e);
                                }
                            })
                            .forEach(updated::add);
                } catch (UncheckedIOException e) {
                    throw e.getCause();
                }
            }
        }
        if (updated.isEmpty()) {
            return null;
        }
        StringBuilder causeOfRebuild = causeOfRebuild("some dependencies changed", showCompilationChanges);
        if (showCompilationChanges) {
            for (Path file : updated) {
                causeOfRebuild.append(System.lineSeparator()).append("    ").append(file);
            }
        }
        return causeOfRebuild.toString();
    }