apache/maven · warning

The following plugins are not marked as thread-safe in {}:

Error message

The following plugins are not marked as thread-safe in {}:

What it means

The non-debug branch of BuilderCommon's parallel-safety check: without -X, Maven lists the offending plugins (not individual goals) with 'The following plugins are not marked as thread-safe in <project>:', one plugin id per line, followed by the hint line to enable -X. It is emitted once per project in the reactor whose plan contains unannotated goals.

Source

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

                && 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());
            }
        }

        final String defaulModelId = DefaultLifecycleRegistry.DEFAULT_LIFECYCLE_MODELID;

        List<String> unversionedPlugins = executionPlan.getMojoExecutions().stream()
                .map(MojoExecution::getPlugin)
                .filter(p -> p.getLocation("version") != null
                        && p.getLocation("version").getSource() != null
                        && defaulModelId.equals(

View on GitHub (pinned to e4093d4e12)

Solutions

  1. Upgrade or pin each listed plugin to a thread-safe release in <pluginManagement>.
  2. Run once with -X to map plugin -> exact unsafe goals before editing the POM.
  3. Drop -T (or scope it to safe modules) until the listed plugins are fixed.
  4. Verify the fixed build is deterministic (same outputs with and without -T) before keeping parallelism.

Example fix

<!-- before: no version pinning, default old bindings flagged under -T -->
<build><plugins>
  <plugin><artifactId>maven-pmd-plugin</artifactId></plugin>
</plugins></build>

<!-- after: pin thread-safe versions -->
<build><pluginManagement><plugins>
  <plugin><artifactId>maven-pmd-plugin</artifactId><version>3.27.0</version></plugin>
</plugins></pluginManagement></build>
Defensive patterns

Strategy: validation

Validate before calling

# guard: fail CI if any non-thread-safe plugin is listed
mvn -T 1C -Dstyle.color=never package 2>&1 \
  | tee /tmp/build.log | grep -q 'not marked as thread-safe' \
  && { echo 'non-thread-safe plugins present'; exit 1; } || true

Prevention

When it happens

Trigger: Parallel session (threads > 1, >1 project) with non-thread-safe plugins in the plan and debug logging disabled — the default 'mvn -T 4 ...' invocation.

Common situations: Standard parallel CI builds; onboarding a legacy multi-module project onto -T 1C and discovering which plugins are unannotated.

Related errors


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