apache/maven · warning

Your build is requesting parallel execution, but this projec

Error message

Your build is requesting parallel execution, but this project contains the following plugin(s) that have goals not marked as thread-safe to support parallel 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.

What it means

Before executing a project's plan, BuilderCommon checks whether the session requests parallelism (degreeOfConcurrency > 1 and more than one project) and whether the calculated execution plan contains plugins whose goals are not marked @threadSafe (executionPlan.getNonThreadSafePlugins()). If any exist, this multi-line warning is printed (via MultilineMessageHelper) followed by the plugin list — the build proceeds, but Maven disclaims responsibility for races in those goals.

Source

Thrown at impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderCommon.java:123

                    PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException,
                    NoPluginFoundForPrefixException, LifecycleNotFoundException, PluginVersionResolutionException,
                    LifecycleExecutionException {
        MavenExecutionPlan executionPlan =
                lifeCycleExecutionPlanCalculator.calculateExecutionPlan(session, project, taskSegment.getTasks());

        lifecycleDebugLogger.debugProjectPlan(project, executionPlan);

        if (session.getRequest().getDegreeOfConcurrency() > 1
                && session.getProjects().size() > 1) {
            final Set<Plugin> unsafePlugins = executionPlan.getNonThreadSafePlugins();
            if (!unsafePlugins.isEmpty()) {
                for (String s : MultilineMessageHelper.format(
                        "Your build is requesting parallel execution, but this project contains the following "
                                + "plugin(s) that have goals not marked as thread-safe to support parallel 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()) {
                    final Set<MojoDescriptor> unsafeGoals = executionPlan.getNonThreadSafeMojos();
                    logger.warn("The following goals are not marked as thread-safe in " + project.getName() + ":");
                    for (MojoDescriptor unsafeGoal : unsafeGoals) {
                        logger.warn("  " + unsafeGoal.getId());
                    }
                } else {
                    logger.warn("The following plugins are not marked as thread-safe in " + project.getName() + ":");
                    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. Upgrade each listed plugin to a version whose goals are marked thread-safe (check its goal annotations/release notes).
  2. If the goal is genuinely thread-safe but unannotated, ask the maintainer to add @threadSafe; for your own mojos add the annotation only after verifying statelessness.
  3. Run the build without -T if listed plugins are known unsafe and output corruption is observed.
  4. Use -X to see exactly which goals (not just plugins) are unmarked, then fix those bindings.

Example fix

<!-- before: old javadoc plugin not thread-safe, build races under -T -->
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-javadoc-plugin</artifactId>
  <version>2.10.4</version>
</plugin>

<!-- after: pinned thread-safe version -->
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-javadoc-plugin</artifactId>
  <version>3.11.2</version>
</plugin>
Defensive patterns

Strategy: validation

Validate before calling

# guard: before enabling -T, check each plugin goal's Thread Safe flag
mvn help:describe -Dplugin=org.apache.maven.plugins:maven-javadoc-plugin -Dgoal=jar -Ddetail | grep -i 'thread safe'

Prevention

When it happens

Trigger: Running 'mvn -T ...' (or -Dmaven.parallel=true style session config) on a multi-module project whose plan includes at least one mojo whose descriptor lacks threadSafe=true — e.g. older maven-javadoc, maven-pmd, apt-maven-plugin, or custom mojos without @threadSafe.

Common situations: Teams enabling -T 1C in CI to speed up builds; upgrading Maven while keeping old plugin versions that predate thread-safety annotations; custom in-house plugins never audited for concurrency.

Related errors


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