apache/maven · warning
Ignored invalid goal specification '{}' from lifecycle mappi
Error message
Ignored invalid goal specification '{}' from lifecycle mapping for phase {} What it means
DefaultLifecyclePluginAnalyzer converts a packaging's lifecycle mapping into plugin executions for the 'clean-less' default lifecycle analysis. parseGoalSpec returns null for any goal string that is not exactly groupId:artifactId:goal or groupId:artifactId:version:goal; such entries are skipped with this warning, leaving the phase without that execution.
Source
Thrown at impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecyclePluginAnalyzer.java:144
return lookup.lookupOptional(LifecycleMapping.class, packaging).orElse(null);
}
private void parseLifecyclePhaseDefinitions(Map<Plugin, Plugin> plugins, String phase, LifecyclePhase goals) {
InputSource inputSource = new InputSource();
inputSource.setModelId(DefaultLifecycleRegistry.DEFAULT_LIFECYCLE_MODELID);
InputLocation location = new InputLocation(-1, -1, inputSource);
location.setLocation(0, location);
List<LifecycleMojo> mojos = goals.getMojos();
if (mojos != null) {
for (int i = 0; i < mojos.size(); i++) {
LifecycleMojo mojo = mojos.get(i);
GoalSpec gs = parseGoalSpec(mojo.getGoal());
if (gs == null) {
logger.warn(
"Ignored invalid goal specification '{}' from lifecycle mapping for phase {}",
mojo.getGoal(),
phase);
continue;
}
Plugin plugin = new Plugin();
plugin.setGroupId(gs.groupId);
plugin.setArtifactId(gs.artifactId);
plugin.setVersion(gs.version);
plugin.setLocation("", location);
plugin.setLocation("groupId", location);
plugin.setLocation("artifactId", location);
plugin.setLocation("version", location);
Plugin existing = plugins.get(plugin);
if (existing != null) {View on GitHub (pinned to e4093d4e12)
Solutions
- Fix the goal specification in the packaging plugin's lifecycle mapping to groupId:artifactId[:version]:goal
- Reinstall the packaging plugin and re-run so the corrected mapping is re-analyzed
- Confirm the phase executes the expected goals afterwards (mvn -X shows the derived plugin executions)
Example fix
# lifecycle mapping goal specs # before my-plugin:my-goal # invalid: 2 segments com.acme:my-plugin:1.0:my-goal:extra # invalid: 5 segments # after com.acme:my-plugin:my-goal # 3 segments: ok com.acme:my-plugin:1.0:my-goal # 4 segments: ok
Defensive patterns
Strategy: validation
Validate before calling
// guard in DefaultLifecyclePluginAnalyzer-style flows: reject bad specs before analysis
static boolean isValidGoalSpec(String goal) {
String[] p = goal.split(":");
return (p.length == 3 || p.length == 4) && Arrays.stream(p).noneMatch(String::isEmpty);
}
if (!isValidGoalSpec(mojo.getGoal())) failFast(mojo.getGoal()); Prevention
- Parse-test lifecycle mapping metadata in the packaging plugin's build
- Keep goal specs as g:a:goal or g:a:v:goal exactly - no prefixes, no empty segments
When it happens
Trigger: The <lifecycle> metadata of a custom packaging (its LifecycleMojo list) contains a malformed goal string - wrong segment count, empty segments, or a stray prefix - when Maven derives the default lifecycle plugin bindings for the packaging.
Common situations: Hand-written packaging descriptors; copy-paste from documentation examples that omit the groupId; mappings edited directly inside the built plugin jar.
Related errors
- Ignored invalid goal specification '{}' from lifecycle mappi
- No plugin descriptor found at ${pluginDescriptorLocation}
- Invalid 'requiredJavaVersion' given in plugin descriptor
- Duplicated lifecycle phase {}. Defined in {} but also in {}
AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21).
Data as JSON: /api/errors/a6c4e87ab1635429.
Report an issue: GitHub.