apache/maven · error · IllegalStateException

findMandatoryRoot failed

Error message

findMandatoryRoot failed

What it means

Error "findMandatoryRoot failed" thrown in apache/maven.

Source

Thrown at impl/maven-impl/src/main/java/org/apache/maven/impl/model/rootlocator/DefaultRootLocator.java:75

        return rootDirectory;
    }

    @Nonnull
    @Override
    public Path findMandatoryRoot(@Nonnull Path basedir) {
        Path rootDirectory = findRoot(basedir);
        Optional<Path> rdf = getRootDirectoryFallback();
        if (rootDirectory == null) {
            rootDirectory = rdf.orElseThrow(() -> new IllegalStateException(getNoRootMessage()));
            logger.warn(getNoRootMessage());
        } else {
            if (rdf.isPresent()) {
                try {
                    if (!Files.isSameFile(rootDirectory, rdf.orElseThrow())) {
                        logger.warn("Project root directory and multiModuleProjectDirectory are not aligned");
                    }
                } catch (IOException e) {
                    throw new IllegalStateException("findMandatoryRoot failed", e);
                }
            }
        }
        return rootDirectory;
    }

    protected boolean isRootDirectory(Path dir) {
        requireNonNull(dir, "dir is null");
        for (RootDetector rootDetector : rootDetectors) {
            if (rootDetector.isRootDirectory(dir)) {
                return true;
            }
        }
        return false;
    }

    protected Optional<Path> getRootDirectoryFallback() {
        String mmpd = System.getProperty("maven.multiModuleProjectDirectory");

View on GitHub (pinned to e4093d4e12)

When it happens

Trigger: Thrown at impl/maven-impl/src/main/java/org/apache/maven/impl/model/rootlocator/DefaultRootLocator.java:75 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21). Data as JSON: /api/errors/2edfda9bdb704211. Report an issue: GitHub.