{"record":{"id":"47b17474c2308a00","repo":"apache/maven","slug":"the-following-goals-are-not-marked-as-thread-safe","errorCode":null,"errorMessage":"The following goals are not marked as thread-safe in {}:","messagePattern":"The following goals are not marked as thread-safe in (.+?):","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderCommon.java","lineNumber":127,"sourceCode":"                lifeCycleExecutionPlanCalculator.calculateExecutionPlan(session, project, taskSegment.getTasks());\n\n        lifecycleDebugLogger.debugProjectPlan(project, executionPlan);\n\n        if (session.getRequest().getDegreeOfConcurrency() > 1\n                && session.getProjects().size() > 1) {\n            final Set<Plugin> unsafePlugins = executionPlan.getNonThreadSafePlugins();\n            if (!unsafePlugins.isEmpty()) {\n                for (String s : MultilineMessageHelper.format(\n                        \"Your build is requesting parallel execution, but this project contains the following \"\n                                + \"plugin(s) that have goals not marked as thread-safe to support parallel execution.\",\n                        \"While this /may/ work fine, please look for plugin updates and/or \"\n                                + \"request plugins be made thread-safe.\",\n                        \"If reporting an issue, report it against the plugin in question, not against Apache Maven.\")) {\n                    logger.warn(s);\n                }\n                if (logger.isDebugEnabled()) {\n                    final Set<MojoDescriptor> unsafeGoals = executionPlan.getNonThreadSafeMojos();\n                    logger.warn(\"The following goals are not marked as thread-safe in \" + project.getName() + \":\");\n                    for (MojoDescriptor unsafeGoal : unsafeGoals) {\n                        logger.warn(\"  \" + unsafeGoal.getId());\n                    }\n                } else {\n                    logger.warn(\"The following plugins are not marked as thread-safe in \" + project.getName() + \":\");\n                    for (Plugin unsafePlugin : unsafePlugins) {\n                        logger.warn(\"  \" + unsafePlugin.getId());\n                    }\n                    logger.warn(\"\");\n                    logger.warn(\"Enable verbose output (-X) to see precisely which goals are not marked as\"\n                            + \" thread-safe.\");\n                }\n                logger.warn(MultilineMessageHelper.separatorLine());\n            }\n        }\n\n        final String defaulModelId = DefaultLifecycleRegistry.DEFAULT_LIFECYCLE_MODELID;\n","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderCommon.java#L109-L145","documentation":"The debug-enabled branch of BuilderCommon's thread-safety check: when -X is active and the plan contains non-thread-safe plugins, Maven logs 'The following goals are not marked as thread-safe in <project>:' followed by one line per unsafe MojoDescriptor id (executionPlan.getNonThreadSafeMojos()). It is the precise, goal-level version of the plugin-level list shown without -X.","triggerScenarios":"Same parallel session conditions as the parent warning (degreeOfConcurrency > 1, multiple projects, non-empty getNonThreadSafePlugins()) plus logger.isDebugEnabled() — i.e. Maven invoked with -X or -e/-debug output.","commonSituations":"Diagnosing which exact goals break a -T build after seeing the plugin-level warning; CI debug logs showing goal ids like 'maven-javadoc-plugin:3.x:jar (attach-javadocs)'.","solutions":["Use the listed goal ids to pin/upgrade exactly those plugin versions in pluginManagement.","Re-run without -T for the modules that execute those goals if they cannot be upgraded.","Bind those goals to a forked or sequential part of the build so they never run concurrently.","For your own plugin, add org.apache.maven.plugins.annotations.Mojo(threadSafe = true) once verified."],"exampleFix":"# before\nmvn -T 1C package   # warn: plugins not marked thread-safe\n\n# after: identify exact goals, then pin fixed versions\nmvn -X -T 1C package | grep -A20 'not marked as thread-safe'\n# -> maven-pmd-plugin:3.13.0:pmd  => upgrade to 3.27.0 in pluginManagement","handlingStrategy":"validation","validationCode":"# guard: capture goal-level report once, gate CI on it being empty\nmvn -X -T 1C package 2>&1 | grep -A50 'goals are not marked as thread-safe' | tee /tmp/unsafe.txt\ntest ! -s /tmp/unsafe.txt","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run one -X pass when adding -T to a project; record the exact unsafe goals.","Fix or re-bind only those goals rather than disabling parallelism project-wide."],"tags":["maven","parallel-build","thread-safety","debug-logging","plugin-compatibility"],"backgroundTag":"maven-plugin-not-thread-safe","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}