apache/maven · warning

The following goals are not Maven 4 goals:

Error message

The following goals are not Maven 4 goals:

What it means

Debug branch of BuildPlanExecutor.checkThreadSafety(): with -X enabled and non-v4-API executions present in a concurrent (threads > 1) build, Maven logs 'The following goals are not Maven 4 goals:' followed by each unsafe MojoDescriptor id. It names the exact goals that lack v4 API support, complementing the plugin-level list shown without debug.

Source

Thrown at impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlanExecutor.java:329

                Set<MojoExecution> unsafeExecutions = buildPlan
                        .allSteps()
                        .flatMap(step -> step.mojos.values().stream().flatMap(map -> map.values().stream()))
                        .filter(execution -> !execution.getMojoDescriptor().isV4Api())
                        .collect(Collectors.toSet());
                if (!unsafeExecutions.isEmpty()) {
                    for (String s : MultilineMessageHelper.format("""
                                Your build is requesting concurrent execution, but this project contains the \
                                following plugin(s) that have goals not built with Maven 4 to support concurrent \
                                execution. While this /may/ work fine, please look for plugin updates and/or \
                                request plugins be made thread-safe. If reporting an issue, report it against the \
                                plugin in question, not against Apache Maven.""")) {
                        logger.warn(s);
                    }
                    if (logger.isDebugEnabled()) {
                        Set<MojoDescriptor> unsafeGoals = unsafeExecutions.stream()
                                .map(MojoExecution::getMojoDescriptor)
                                .collect(Collectors.toSet());
                        logger.warn("The following goals are not Maven 4 goals:");
                        for (MojoDescriptor unsafeGoal : unsafeGoals) {
                            logger.warn("  " + unsafeGoal.getId());
                        }
                    } else {
                        Set<Plugin> unsafePlugins = unsafeExecutions.stream()
                                .map(MojoExecution::getPlugin)
                                .collect(Collectors.toSet());
                        logger.warn("The following plugins are not Maven 4 plugins:");
                        for (Plugin unsafePlugin : unsafePlugins) {
                            logger.warn("  " + unsafePlugin.getId());
                        }
                        logger.warn("");
                        logger.warn("Enable verbose output (-X) to see precisely which goals are not marked as"
                                + " thread-safe.");
                    }
                    logger.warn(MultilineMessageHelper.separatorLine());
                }
            }

View on GitHub (pinned to e4093d4e12)

Solutions

  1. Use the printed goal ids to upgrade precisely those plugins to v4-built releases.
  2. Run without -T until every listed goal has a v4-compatible version.
  3. For in-house plugins, port the listed mojos to the Maven 4 API (org.apache.maven.api.plugin annotations).

Example fix

# before
mvn -T 1C package   # plugins 'not built with Maven 4'

# after: get goal-level detail, then upgrade those plugins
mvn -X -T 1C package 2>&1 | grep -A20 'not Maven 4 goals'
Defensive patterns

Strategy: validation

Validate before calling

# guard: extract goal-level v4 report and gate on it
mvn -X -T 1C package 2>&1 | grep -A50 'not Maven 4 goals' | tee v3-goals.txt
test ! -s v3-goals.txt

Prevention

When it happens

Trigger: Maven 4 concurrent build (threads > 1) containing goals with isV4Api() == false, invoked with -X/debug logging so logger.isDebugEnabled() is true.

Common situations: Triaging a Maven 4 -T build to find exactly which goals (e.g. 'maven-compiler-plugin:3.13.0:compile') still use the v3 API before deciding what can safely run concurrently.

Related errors


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