{"record":{"id":"36405b87daf0041a","repo":"apache/maven","slug":"lifecycle-bindings-injector-is-missing","errorCode":null,"errorMessage":"lifecycle bindings injector is missing","messagePattern":"lifecycle bindings injector is missing","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"compat/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java","lineNumber":524,"sourceCode":"            throws ModelBuildingException {\n        // phase 2\n        Model resultModel = result.getEffectiveModel();\n\n        DefaultModelProblemCollector problems = new DefaultModelProblemCollector(result);\n        problems.setSource(resultModel);\n        problems.setRootModel(resultModel);\n\n        // model path translation\n        modelPathTranslator.alignToBaseDirectory(resultModel, resultModel.getProjectDirectory(), request);\n\n        // plugin management injection\n        pluginManagementInjector.injectManagement(resultModel, request, problems);\n\n        fireEvent(resultModel, request, problems, ModelBuildingEventCatapult.BUILD_EXTENSIONS_ASSEMBLED);\n\n        if (request.isProcessPlugins()) {\n            if (lifecycleBindingsInjector == null) {\n                throw new IllegalStateException(\"lifecycle bindings injector is missing\");\n            }\n\n            // lifecycle bindings injection\n            lifecycleBindingsInjector.injectLifecycleBindings(resultModel, request, problems);\n        }\n\n        // dependency management import\n        importDependencyManagement(resultModel, request, problems, imports);\n\n        // dependency management injection\n        dependencyManagementInjector.injectManagement(resultModel, request, problems);\n\n        modelNormalizer.injectDefaultValues(resultModel, request, problems);\n\n        if (request.isProcessPlugins()) {\n            // reports configuration\n            reportConfigurationExpander.expandPluginConfiguration(resultModel, request, problems);\n","sourceCodeStart":506,"sourceCodeEnd":542,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/compat/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java#L506-L542","documentation":"DefaultModelBuilder needs a LifecycleBindingsInjector component to inject default lifecycle bindings (packaging-to-goal mappings) whenever the request has processPlugins enabled. The injector is a pluggable field, not auto-created; if the builder was wired without it, model building fails fast with this IllegalStateException before injection runs.","triggerScenarios":"Constructing DefaultModelBuilder manually without setting a LifecycleBindingsInjector, then building a ModelBuildingRequest with isProcessPlugins() == true, typical in unit tests or custom embedded wiring.","commonSituations":"Test code that news up DefaultModelBuilder by hand; DI containers that do not register the lifecycle bindings injector component; migrations between Maven versions where wiring assumptions changed.","solutions":["Wire the injector: builder.setLifecycleBindingsInjector(new DefaultLifecycleBindingsInjector()) or register the component in your DI container","If plugin processing is not needed (pure model reading/validation tests), call request.setProcessPlugins(false)","Prefer obtaining a fully wired ModelBuilder from DefaultModelBuilderFactory instead of manual construction","Audit custom wiring once against the builder's full component list after Maven upgrades"],"exampleFix":"// before: hand-wired builder without the injector, plugins processed\nDefaultModelBuilder builder = new DefaultModelBuilder()\n    .setModelProcessor(processor)\n    .setModelValidator(validator); // no lifecycle bindings injector\nrequest.setProcessPlugins(true);\n\n// after: wire the missing component (or disable plugin processing in read-only tests)\nDefaultModelBuilder builder = new DefaultModelBuilder()\n    .setModelProcessor(processor)\n    .setModelValidator(validator)\n    .setLifecycleBindingsInjector(new DefaultLifecycleBindingsInjector());\n// or: request.setProcessPlugins(false);","handlingStrategy":"validation","validationCode":"// Guarantee the wiring contract before building with plugins enabled\nDefaultModelBuilder builder = new DefaultModelBuilder()\n        .setModelProcessor(processor)\n        .setModelValidator(validator)\n        .setLifecycleBindingsInjector(new DefaultLifecycleBindingsInjector());\n// and in model-only tests, avoid the requirement entirely:\nrequest.setProcessPlugins(false);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Build ModelBuilder via DefaultModelBuilderFactory instead of manual wiring","If wiring manually, include one plugin-processing build in unit tests to catch missing components","In read-only model tests, always call request.setProcessPlugins(false)"],"tags":["maven","model-building","di-wiring","missing-component","plugin-lifecycle"],"backgroundTag":"missing-required-component","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}