apache/maven · warning
Try running the build up to the lifecycle phase "package"
Error message
Try running the build up to the lifecycle phase "package"
What it means
Emitted by LifecycleDependencyResolver when an aggregating mojo in a multi-module (reactor) build asks for the current project's dependencies before those artifacts have been assembled. Per MNG-2277, Maven tolerates the situation only when every unresolved dependency is itself a reactor project: it prints this warning plus the list of unresolved dependencies instead of failing; for non-aggregator mojos (or unresolved external deps) the same method throws LifecycleExecutionException. The warning tells you the plugin is running in a phase that precedes artifact assembly, which aggregator plugins like release:prepare historically do.
Source
Thrown at impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolver.java:277
result = dependenciesResolver.resolve(request);
} catch (DependencyResolutionException e) {
result = e.getResult();
/*
* MNG-2277, the check below compensates for our bad plugin support where we ended up with aggregator
* plugins that require dependency resolution, although they usually run in phases of the build where project
* artifacts haven't been assembled yet. The prime example of this is "mvn release:prepare".
*/
if (aggregating && areAllDependenciesInReactor(session.getProjects(), result.getUnresolvedDependencies())) {
logger.warn("The following dependencies could not be resolved at this point of the build"
+ " but seem to be part of the reactor:");
for (Dependency dependency : result.getUnresolvedDependencies()) {
logger.warn("o {}", dependency);
}
logger.warn("Try running the build up to the lifecycle phase \"package\"");
} else {
throw new LifecycleExecutionException(messageBuilderFactory, null, project, e);
}
}
eventSpyDispatcher.onEvent(result);
Set<Artifact> artifacts = new LinkedHashSet<>();
if (result.getDependencyGraph() != null
&& !result.getDependencyGraph().getChildren().isEmpty()) {
RepositoryUtils.toArtifacts(
artifacts,
result.getDependencyGraph().getChildren(),
Collections.singletonList(project.getArtifact().getId()),
collectionFilter);
}
return new SetWithResolutionResult(result, artifacts);
}View on GitHub (pinned to e4093d4e12)
Solutions
- Run the build up to 'package' first (e.g. 'mvn package') and then run the aggregator goal, exactly as the message suggests, so reactor artifacts exist in the local repo.
- Bind the aggregator execution to 'package' or a later phase in the POM instead of an early phase (move <phase> in the plugin <execution>).
- If the missing dependencies are NOT reactor projects, fix the actual resolution problem (missing version, wrong repository, not installed) — that path throws LifecycleExecutionException.
- Plugin authors: defer dependency resolution until after packaging, or resolve only module-level dependencies that are already available instead of the full reactor artifact set.
Example fix
// before: aggregator goal resolves deps before upstream modules are packaged mvn release:prepare # warns: dependencies could not be resolved at this point // after: assemble reactor artifacts first, then run the aggregator goal mvn package mvn release:prepare
Defensive patterns
Strategy: validation
Validate before calling
# guard: build reactor artifacts before any aggregator goal that resolves dependencies mvn -q -DskipTests package mvn release:prepare # now reactor artifacts exist
Try / catch
// embedders: the same method throws LifecycleExecutionException when deps are NOT in the reactor
try {
lifecycleModuleBuilder.buildProject(session, rootSession, currentSession, project, taskSegment);
} catch (LifecycleExecutionException e) {
// inspect e.getMessage() for the unresolvable GAVs; fix POM/repos, do not retry blindly
} Prevention
- Never bind aggregator executions to phases before 'package' in multi-module builds.
- In CI, run 'mvn package' (or 'install') before standalone aggregator invocations like release:prepare.
- Custom aggregator mojos: do not read project.getArtifacts() before packaging; resolve lazily or use reactor project references.
When it happens
Trigger: Running an aggregator/plugin-without-project goal that triggers dependency resolution in a phase before 'package' in a multi-module build (prime example: 'mvn release:prepare'); a custom mojo marked @aggregator (or with requiresProject=false) that reads project.getArtifacts()/getDependencies() early; invoking a direct goal (e.g. 'mvn some-aggregator:goal') at the start of the reactor before upstream modules are built, where all missing GAVs match reactor projects (areAllDependenciesInReactor returns true).
Common situations: Multi-module release runs with maven-release-plugin; site or reporting aggregators bound to early phases; custom aggregator mojos resolving compile-scope dependencies of inter-dependent modules; partially built reactor where module A depends on module B but B's artifact is not yet packaged.
Related errors
- Two or more projects in the reactor have the same identifier
- Edge between '{}' and '{}' introduces to cycle in the graph
- Project '{}' is duplicated in the reactor
- No unique Source for %s:%s: %s and %s
- The following dependencies could not be resolved at this poi
AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21).
Data as JSON: /api/errors/d23cf5213c82cf20.
Report an issue: GitHub.