apache/maven · warning

{} {} encountered while building the effective model for '{}

Error message

{} {} encountered while building the effective model for '{}' (use -e to see details)

What it means

After selecting the projects for the reactor, DefaultProjectsSelector counted ProjectBuildingResult problems for a project and found at least one. The warning states how many problems (singular/plural verb is chosen) were recorded while building that project's effective model; the details are only listed when -e or -X is enabled. The build still proceeds unless one of the problems had ERROR severity, in which case ProjectBuildingException is thrown separately.

Source

Thrown at impl/maven-core/src/main/java/org/apache/maven/project/collector/DefaultProjectsSelector.java:74

            throws ProjectBuildingException {
        ProjectBuildingRequest projectBuildingRequest = request.getProjectBuildingRequest();

        boolean hasProjectSelection = !request.getProjectActivation().isEmpty();
        boolean isRecursive = hasProjectSelection || request.isRecursive();
        List<ProjectBuildingResult> results = projectBuilder.build(files, isRecursive, projectBuildingRequest);

        List<MavenProject> projects = new ArrayList<>(results.size());

        long totalProblemsCount = 0;

        for (ProjectBuildingResult result : results) {
            projects.add(result.getProject());

            int problemsCount = result.getProblems().size();
            totalProblemsCount += problemsCount;
            if (problemsCount != 0 && LOGGER.isWarnEnabled()) {
                LOGGER.warn("");
                LOGGER.warn(
                        "{} {} encountered while building the effective model for '{}' (use -e to see details)",
                        problemsCount,
                        (problemsCount == 1) ? "problem was" : "problems were",
                        result.getProjectId());

                if (request.isShowErrors()) { // this means -e or -X (as -X enables -e as well)
                    for (ModelProblem problem : result.getProblems()) {
                        String loc = ModelProblemUtils.formatLocation(problem, result.getProjectId());
                        LOGGER.warn("{}{}", problem.getMessage(), ((loc != null && !loc.isEmpty()) ? " @ " + loc : ""));
                    }
                }
            }
        }

        if (totalProblemsCount > 0) {
            LOGGER.warn("");
            LOGGER.warn("Total model problems reported: {}", totalProblemsCount);
            LOGGER.warn("");

View on GitHub (pinned to e4093d4e12)

Solutions

  1. Re-run the same command with -e (or -X) to make Maven print each problem message with its location on the next lines
  2. Fix the reported problems at the cited file/line, starting with any ERROR severity entries
  3. If problems come from a parent or BOM, fix them at the source and rebuild with -U to refresh snapshots

Example fix

# before: problems hidden behind the summary
mvn clean install

# after: show every model problem with its location
mvn -e clean install
Defensive patterns

Strategy: validation

Validate before calling

// Embedding Maven: inspect problems before using the selected projects
List<ProjectBuildingResult> results = projectBuilder.build(sortedRequests, request);
for (ProjectBuildingResult r : results) {
    List<ModelProblem> fatal = r.getProblems().stream()
            .filter(p -> p.getSeverity() == Severity.ERROR).toList();
    if (!fatal.isEmpty()) fail("model errors in " + r.getProjectId() + ": " + fatal);
    else if (!r.getProblems().isEmpty()) warn("{} model problems in {}", r.getProblems().size(), r.getProjectId());
}

Try / catch

// Catch the aggregate failure and enumerate problems like the -e listing
try {
    List<MavenProject> projects = projectBuilder.build(request); // collector path
} catch (ProjectBuildingException e) {
    for (ModelProblem p : e.getProblems()) {
        System.err.printf("%s @ %s%n", p.getMessage(),
                org.apache.maven.model.building.ModelProblemUtils.formatLocation(p, e.getProjectId()));
    }
}

Prevention

When it happens

Trigger: mvn <goals> on a single- or multi-module request where any produced ProjectBuildingResult carries problems: malformed POM values, deprecated constructs, unresolvable parents, validation warnings from model validators. The count is result.getProblems().size(), summed across projects for the trailing banner.

Common situations: CI log audits reacting to the word 'problem'; builds mixing plugin versions with malformed <configuration>; projects relying on lenient parsing that newer Maven validators flag; after a Maven upgrade that tightened model validation.

Related errors


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