apache/maven · error · RuntimeException
Unable to load plugin lifecycles
Error message
Unable to load plugin lifecycles
What it means
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.
Source
Thrown at impl/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultMojoExecution.java:78
@Override
public org.apache.maven.api.model.Plugin getModel() {
return delegate.getPlugin().getDelegate();
}
@Override
public PluginDescriptor getDescriptor() {
return delegate.getMojoDescriptor().getPluginDescriptor().getPluginDescriptorV4();
}
@Override
public List<Lifecycle> getLifecycles() {
try {
return Collections.unmodifiableList(new ArrayList<>(delegate.getMojoDescriptor()
.getPluginDescriptor()
.getLifecycleMappings()
.values()));
} catch (Exception e) {
throw new RuntimeException("Unable to load plugin lifecycles", e);
}
}
@Override
public ClassLoader getClassLoader() {
return delegate.getMojoDescriptor().getRealm();
}
@Override
public Artifact getArtifact() {
org.apache.maven.artifact.Artifact artifact =
delegate.getMojoDescriptor().getPluginDescriptor().getPluginArtifact();
org.eclipse.aether.artifact.Artifact resolverArtifact = RepositoryUtils.toArtifact(artifact);
return resolverArtifact != null ? session.getArtifact(resolverArtifact) : null;
}
@Override
public Map<String, Dependency> getDependenciesMap() {View on GitHub (pinned to e4093d4e12)
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
Defensive patterns
Strategy: try-catch
Validate before calling
// Sanity-check the plugin artifact before use
Path jar = pluginArtifact.getFile().toPath();
if (!Files.exists(jar) || tryOpenZip(jar) != null) {
throw new IllegalStateException("Corrupt plugin jar, re-fetch with mvn -U: " + jar);
} Try / catch
try {
lifecycles = mojoExecutionProvider.getLifecycles();
} catch (RuntimeException e) {
if ("Unable to load plugin lifecycles".equals(e.getMessage()) && e.getCause() != null) {
throw new IllegalStateException("Plugin " + pluginKey + " descriptor unreadable: "
+ e.getCause().getMessage()
+ "; delete its folder under the local repo and rebuild with -U", e);
}
throw e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Unsupported class-loading strategy '{}'. Supported values ar
- {parameterName} has been declared multiple times in mojo wit
- Goal: {goal} already exists in the plugin descriptor for pre
- Found duplicated phase '{}' in '{}' lifecycle
- Unknown lifecycle phase "{}". You must specify a valid lifec
AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21).
Data as JSON: /api/errors/fcb38501b16c49eb.
Report an issue: GitHub.