protected boolean isDependencyChanged()

in src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java [1542:1575]


    protected boolean isDependencyChanged() {
        if (session == null) {
            // we just cannot determine it, so don't do anything beside logging
            getLog().info("Cannot determine build start date, skipping incremental build detection.");
            return false;
        }

        if (fileExtensions == null || fileExtensions.isEmpty()) {
            fileExtensions = Collections.unmodifiableList(Arrays.asList("class", "jar"));
        }

        Date buildStartTime = getBuildStartTime();

        List<String> pathElements = new ArrayList<>();
        pathElements.addAll(getClasspathElements());
        pathElements.addAll(getModulepathElements());

        for (String pathElement : pathElements) {
            File artifactPath = new File(pathElement);
            if (artifactPath.isDirectory() || artifactPath.isFile()) {
                if (!artifactPath.equals(getOutputDirectory()) && hasNewFile(artifactPath, buildStartTime)) {
                    if (showCompilationChanges) {
                        getLog().info("New dependency detected: " + artifactPath.getAbsolutePath());
                    } else {
                        getLog().debug("New dependency detected: " + artifactPath.getAbsolutePath());
                    }
                    return true;
                }
            }
        }

        // obviously there was no new file detected.
        return false;
    }