quarkusio/quarkus · error · GradleException
Failed to find project for dependency:
Error message
Failed to find project for dependency:
What it means
In DependencyDataCollector.addDeclaredFromConfig, when a declared dependency is a ProjectDependency, the code verifies the target project actually exists via Project.findProject(path). The comment says 'should not happen' — a ProjectDependency should always reference a project in the same build — so failing the lookup indicates a corrupted or inconsistent project model, and a GradleException is thrown with the dependency path in the message.
Source
Thrown at devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/tooling/dependency/DependencyDataCollector.java:318
}
private static void addDeclaredFromConfig(Project p, String cfgName, String scope,
Map<GAV, DeclaredDependency> out) {
final Configuration cfg = p.getConfigurations().findByName(cfgName);
if (cfg == null) {
return;
}
for (var d : cfg.getDependencies()) {
var gav = new GAV(
String.valueOf(d.getGroup()),
d.getName(),
String.valueOf(d.getVersion()));
if (d instanceof ProjectDependency pd) {
Project dp = p.findProject(pd.getPath());
if (dp == null) {
// should not happen
throw new GradleException("Failed to find project for dependency: " + pd.getPath());
}
}
out.put(gav, new DeclaredDependency(
gav.getGroupId(),
gav.getArtifactId(),
gav.getVersion(),
null,
null,
scope,
false));
}
}
private static List<DeclaredDependency> toDeclaredDependencies(Model model) {
final List<DeclaredDependency> declaredDeps = new ArrayList<>();
for (org.apache.maven.model.Dependency dep : model.getDependencies()) {
if (!SCOPE_TEST.equals(dep.getScope())) {View on GitHub (pinned to e1c734241f)
Solutions
- Stop the Gradle daemon and rebuild (./gradlew --stop) to discard a stale project model
- Verify the project path in the error exists in settings.gradle include statements
- Check for composite-build project substitutions that point across build boundaries; declare the dependency via includeBuild + substitution instead
- Clear the configuration cache (.gradle/configuration-cache) if enabled
- If reproducible, file a Quarkus issue with the project layout — this is expected to be unreachable
Example fix
null
Defensive patterns
Strategy: validation
Validate before calling
d.getDependencyConstraint();
if (d instanceof ProjectDependency pd && p.findProject(pd.getPath()) == null) {
throw new IllegalStateException("ProjectDependency path not resolvable: " + pd.getPath());
} Try / catch
try {
collector.collectDeclaredFromProject(project);
} catch (GradleException e) {
if (e.getMessage().startsWith("Failed to find project for dependency:")) {
logger.warn("Stale project model; retry after ./gradlew --stop");
} else throw e;
} Prevention
- Keep settings.gradle includes in sync with ProjectDependency declarations
- Stop the daemon after structural project changes
- Prefer includeBuild + dependency substitution over cross-build project paths
- Clear .gradle/configuration-cache when project layout changes
When it happens
Trigger: Calling collectDeclaredFromProject over configuration dependencies when a ProjectDependency's path (pd.getPath()) is not found by p.findProject(pd.getPath()) — e.g. cross-build project dependencies or projects registered under a different path than the dependency claims.
Common situations: Composite builds substituting a module with a project from another build whose path is not resolvable from the current root; renamed subprojects after stale Gradle daemon state; generated projects where settings.gradle and dependency declarations disagree.
Related errors
- Failed to copy %s to %s
- Failed to locate io.quarkus:quarkus-core-deployment on the a
- Project dependency not found for path:
- ${misalignmentReport}
- Failed to resolve ${appArtifact}
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/46838c1895c093c4.
Report an issue: GitHub.