{"record":{"id":"fcb38501b16c49eb","repo":"apache/maven","slug":"unable-to-load-plugin-lifecycles","errorCode":null,"errorMessage":"Unable to load plugin lifecycles","messagePattern":"Unable to load plugin lifecycles","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"impl/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultMojoExecution.java","lineNumber":78,"sourceCode":"            @Override\n            public org.apache.maven.api.model.Plugin getModel() {\n                return delegate.getPlugin().getDelegate();\n            }\n\n            @Override\n            public PluginDescriptor getDescriptor() {\n                return delegate.getMojoDescriptor().getPluginDescriptor().getPluginDescriptorV4();\n            }\n\n            @Override\n            public List<Lifecycle> getLifecycles() {\n                try {\n                    return Collections.unmodifiableList(new ArrayList<>(delegate.getMojoDescriptor()\n                            .getPluginDescriptor()\n                            .getLifecycleMappings()\n                            .values()));\n                } catch (Exception e) {\n                    throw new RuntimeException(\"Unable to load plugin lifecycles\", e);\n                }\n            }\n\n            @Override\n            public ClassLoader getClassLoader() {\n                return delegate.getMojoDescriptor().getRealm();\n            }\n\n            @Override\n            public Artifact getArtifact() {\n                org.apache.maven.artifact.Artifact artifact =\n                        delegate.getMojoDescriptor().getPluginDescriptor().getPluginArtifact();\n                org.eclipse.aether.artifact.Artifact resolverArtifact = RepositoryUtils.toArtifact(artifact);\n                return resolverArtifact != null ? session.getArtifact(resolverArtifact) : null;\n            }\n\n            @Override\n            public Map<String, Dependency> getDependenciesMap() {","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultMojoExecution.java#L60-L96","documentation":"RuntimeException raised by the LifecycleProvider view inside DefaultMojoExecution when reading lifecycle mappings from a plugin descriptor fails. The method wraps delegate.getMojoDescriptor().getPluginDescriptor().getLifecycleMappings().values() in a try/catch and rethrows any exception with this message; the underlying cause (parse error, missing resource, classloading failure) is attached.","triggerScenarios":"Calling getLifecycles() on a DefaultMojoExecution whose plugin descriptor's lifecycleMappings cannot be materialized: corrupted plugin jar in the local repository, descriptor referencing classes missing from the plugin realm, or a plugin built against an incompatible descriptor/API version.","commonSituations":"Broken/half-written downloads in ~/.m2/repository (interrupted transfers); snapshot plugins whose descriptor and classes drifted out of sync; plugins compiled against old Maven APIs deployed onto a newer Maven.","solutions":["Read the cause for the exact resource or class that failed","Re-fetch the plugin: delete its directory under ~/.m2/repository and rebuild with mvn -U","If descriptor drift on snapshots recurs, pin a released plugin version"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Sanity-check the plugin artifact before use\nPath jar = pluginArtifact.getFile().toPath();\nif (!Files.exists(jar) || tryOpenZip(jar) != null) {\n    throw new IllegalStateException(\"Corrupt plugin jar, re-fetch with mvn -U: \" + jar);\n}","typeGuard":null,"tryCatchPattern":"try {\n    lifecycles = mojoExecutionProvider.getLifecycles();\n} catch (RuntimeException e) {\n    if (\"Unable to load plugin lifecycles\".equals(e.getMessage()) && e.getCause() != null) {\n    throw new IllegalStateException(\"Plugin \" + pluginKey + \" descriptor unreadable: \"\n        + e.getCause().getMessage()\n        + \"; delete its folder under the local repo and rebuild with -U\", e);\n    }\n    throw e;\n}","preventionTips":["Keep local repo on reliable storage; interrupted downloads leave broken jars","Pin released plugin versions instead of snapshots in shared builds","Verify plugin jars (checksums) when provisioning repositories offline"],"tags":["maven","plugin-descriptor","lifecycle","classloading","artifact-corruption"],"backgroundTag":"plugin-descriptor-load-failure","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}