apache/maven · error · MojoNotFoundException
Could not find goal '${goal}' in plugin ${pluginDescriptor.g
Error message
Could not find goal '${goal}' in plugin ${pluginDescriptor.getId()} among available goals ${availableGoals} What it means
getMojoDescriptor() looked up the requested goal name in the plugin's parsed descriptor and found no matching MojoDescriptor, so MojoNotFoundException reports the goal, the plugin id and the goals the descriptor actually offers. Goal names are matched exactly and case-sensitively.
Source
Thrown at impl/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java:299
throws PluginDescriptorParsingException {
try {
return builder.build(is, descriptorLocation);
} catch (PlexusConfigurationException e) {
throw new PluginDescriptorParsingException(plugin, descriptorLocation, e);
}
}
@Override
public MojoDescriptor getMojoDescriptor(
Plugin plugin, String goal, List<RemoteRepository> repositories, RepositorySystemSession session)
throws MojoNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
InvalidPluginDescriptorException {
PluginDescriptor pluginDescriptor = getPluginDescriptor(plugin, repositories, session);
MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo(goal);
if (mojoDescriptor == null) {
throw new MojoNotFoundException(goal, pluginDescriptor);
}
return mojoDescriptor;
}
@Override
public void checkPrerequisites(PluginDescriptor pluginDescriptor) throws PluginIncompatibleException {
List<IllegalStateException> prerequisiteExceptions = new ArrayList<>();
prerequisitesCheckers.forEach(c -> {
try {
c.accept(pluginDescriptor);
} catch (IllegalStateException e) {
prerequisiteExceptions.add(e);
}
});
// aggregate all exceptions
if (!prerequisiteExceptions.isEmpty()) {
String messages = prerequisiteExceptions.stream()View on GitHub (pinned to e4093d4e12)
Solutions
- Copy the exact goal name from the error's 'among available goals' list and rerun.
- List all goals with details: mvn <groupId>:<artifactId>:<version>:help -Ddetail.
- Pin the plugin version in <pluginManagement> whose release actually contains the goal.
- Check spelling and capitalization of the goal name.
Example fix
// before mvn dependenc:analyze // after mvn dependency:analyze
Defensive patterns
Strategy: validation
Validate before calling
mvn <groupId>:<artifactId>:<version>:help -Ddetail 2>&1 | grep ':<goalName>' \ || echo 'goal does not exist in this plugin version'
Try / catch
try {
mojoDescriptor = pluginManager.getMojoDescriptor(plugin, goal, repositories, session.getRepositorySession());
} catch (MojoNotFoundException e) {
throw new IllegalArgumentException("unknown goal '" + goal + "' - run " + plugin.getId() + ":help -Ddetail");
} Prevention
- Pin plugin versions explicitly instead of relying on prefix resolution defaults
- Diff goal lists via g:a:v:help -Ddetail whenever upgrading plugins
- Quote goal names in CI scripts to catch shell munging
When it happens
Trigger: A typo'd goal on the CLI or in an <execution>; a plugin version - pinned explicitly or defaulted via prefix resolution - from a release where the goal was renamed, removed, or not yet introduced; a plugin prefix mapping to a different artifact than expected.
Common situations: CLI typos like mvn dependenc:analyze; prefix resolution defaulting to an old version without a newer goal; copied <execution> blocks referencing goals of a newer plugin version than the pinned one.
Related errors
- Error updating group repository metadata
- Cannot find '{}' in {}
- Unknown lifecycle phase "{}". You must specify a valid lifec
- Unknown cache configuration property: {}
- Repository list contains duplicate entries. Each repository
AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21).
Data as JSON: /api/errors/762980391f1d4a1f.
Report an issue: GitHub.