apache/maven · error · MavenExecutionException

Invalid reactor make behavior: {}

Error message

Invalid reactor make behavior: {}

What it means

MavenExecutionException thrown when MavenExecutionRequest.getMakeBehavior() returns a non-empty string that is neither 'upstream' (-am), 'downstream' (-amd), nor 'upstream-downstream' (both). The Maven CLI only ever produces valid values, so this error almost always comes from code embedding Maven and setting the field directly.

Source

Thrown at impl/maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java:275

            }
        }

        return result;
    }

    private List<MavenProject> includeAlsoMakeTransitively(
            List<MavenProject> projects, MavenExecutionRequest request, ProjectDependencyGraph graph)
            throws MavenExecutionException {
        List<MavenProject> result = projects;

        String makeBehavior = request.getMakeBehavior();
        boolean makeBoth = MavenExecutionRequest.REACTOR_MAKE_BOTH.equals(makeBehavior);

        boolean makeUpstream = makeBoth || MavenExecutionRequest.REACTOR_MAKE_UPSTREAM.equals(makeBehavior);
        boolean makeDownstream = makeBoth || MavenExecutionRequest.REACTOR_MAKE_DOWNSTREAM.equals(makeBehavior);

        if ((makeBehavior != null && !makeBehavior.isEmpty()) && !makeUpstream && !makeDownstream) {
            throw new MavenExecutionException("Invalid reactor make behavior: " + makeBehavior, request.getPom());
        }

        if (makeUpstream || makeDownstream) {
            Set<MavenProject> projectsSet = new HashSet<>(projects);

            for (MavenProject project : projects) {
                if (makeUpstream) {
                    projectsSet.addAll(graph.getUpstreamProjects(project, true));
                }
                if (makeDownstream) {
                    projectsSet.addAll(graph.getDownstreamProjects(project, true));
                }
            }

            result = new ArrayList<>(projectsSet);

            // Order the new list in the original order
            List<MavenProject> sortedProjects = graph.getSortedProjects();

View on GitHub (pinned to e4093d4e12)

Solutions

  1. Use the constants: MavenExecutionRequest.REACTOR_MAKE_UPSTREAM ('upstream'), REACTOR_MAKE_DOWNSTREAM ('downstream'), REACTOR_MAKE_BOTH ('upstream-downstream'), or null/empty string to disable
  2. Map -am to 'upstream', -amd to 'downstream', -am -amd together to 'upstream-downstream'

Example fix

// before
request.setMakeBehavior("also-make"); // Invalid reactor make behavior

// after
request.setMakeBehavior(MavenExecutionRequest.REACTOR_MAKE_UPSTREAM);
Defensive patterns

Strategy: type-guard

Type guard

static boolean isValidMakeBehavior(String makeBehavior) {
    if (makeBehavior == null || makeBehavior.isEmpty()) return true; // disabled
    return makeBehavior.equals(MavenExecutionRequest.REACTOR_MAKE_UPSTREAM)
        || makeBehavior.equals(MavenExecutionRequest.REACTOR_MAKE_DOWNSTREAM)
        || makeBehavior.equals(MavenExecutionRequest.REACTOR_MAKE_BOTH);
}

Prevention

When it happens

Trigger: Programmatic request.setMakeBehavior("also-make") or any invented value; embedders/launchers translating CLI flag names into the field instead of using the defined constants; custom request populators copying raw strings.

Common situations: IDE bootstrap code, maven-invoker-based tools, or tests building MavenExecutionRequest by hand and guessing the make-behavior vocabulary.

Related errors


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