quarkusio/quarkus · error · IllegalStateException
Could not find project for
Error message
Could not find project for
What it means
Thrown by GradleApplicationModelBuilder.initProjectModuleAndBuildPaths as an IllegalStateException when a resolved dependency artifact should correspond to a Gradle project in the current build, but project lookup returned null. A diagnostic message is also printed to System.err with the artifact display name. This means the Quarkus model builder expected the artifact to come from the workspace (a local module) but the resolved artifact cannot be mapped back to any Project in the build.
Source
Thrown at devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/tooling/GradleApplicationModelBuilder.java:532
}
}
if (!isFlagOn(flags, COLLECT_RELOADABLE_MODULES)) {
depBuilder.clearFlag(DependencyFlags.RELOADABLE);
}
}
if (processChildren) {
for (org.gradle.api.artifacts.ResolvedDependency child : resolvedDep.getChildren()) {
collectDependencies(child, workspaceDiscovery, project, artifactFiles, modelBuilder, projectModule, flags);
}
}
}
private void initProjectModuleAndBuildPaths(final Project project,
ResolvedArtifact resolvedArtifact, ApplicationModelBuilder appModel, final ResolvedDependencyBuilder appDep) {
if (project == null) {
System.err.println("Error: could not find project for " + resolvedArtifact.getId().getDisplayName());
throw new IllegalStateException("Could not find project for " + resolvedArtifact.getId().getDisplayName());
}
appDep.setWorkspaceModule().setReloadable();
if (appDep.getWorkspaceModule() == null) {
final WorkspaceModule.Mutable projectModule = appModel.getOrCreateProjectModule(
WorkspaceModuleId.of(resolvedArtifact.getModuleVersion().getId().getGroup(), resolvedArtifact.getName(),
resolvedArtifact.getModuleVersion().getId().getVersion()),
project.getProjectDir(),
project.getLayout().getBuildDirectory().get().getAsFile())
.setBuildFile(project.getBuildFile().toPath());
ProjectDescriptorBuilder.initSourceDirs(project, projectModule);
appDep.setWorkspaceModule(projectModule);
}
appModel.addReloadableWorkspaceModule(appDep.getKey());
}
private boolean processQuarkusDependency(ResolvedDependencyBuilder artifactBuilder, ApplicationModelBuilder modelBuilder) {View on GitHub (pinned to e1c734241f)
Solutions
- Check the artifact display name in the stderr message and confirm a module with that group:name exists in the current Gradle build.
- If using composite/included builds, ensure the included build is registered (settings.gradle includeBuild) and its group:name match the dependency.
- Clean Gradle caches (./gradlew clean, delete ~/.gradle/caches/modules-2 entries for the artifact) after renaming modules.
- Remove duplicate/conflicting coordinate mappings so local modules are referenced as project(':module') dependencies, not external coordinates.
- Upgrade the Quarkus Gradle plugin if the mismatch stems from a plugin bug in project-to-artifact resolution.
Example fix
// before (settings.gradle) // missing includeBuild for a sibling referenced by coordinates // after includeBuild '../my-shared-quarkus-ext'
Defensive patterns
Strategy: validation
Validate before calling
// Validate local module coordinates match dependency coordinates before building:
assert project.group == expectedGroup && project.name == expectedName :
"Module coordinates ${project.group}:${project.name} do not match the dependency ${expectedGroup}:${expectedName}" Try / catch
try {
quarkusDev()
} catch (IllegalStateException e) {
if (e.message?.startsWith('Could not find project for')) {
logger.error('Artifact expected in workspace but not found: ' + e.message)
} else throw e
} Prevention
- Reference local modules via project(':module') instead of external coordinates
- Register all sibling builds with includeBuild in settings.gradle when using composite builds
- After renaming a module, run a clean build and prune stale cache entries
- Keep group/name of each subproject consistent with the published coordinates
When it happens
Trigger: collectDependencies resolves an artifact that the Quarkus Gradle plugin treats as a workspace module (e.g. a project dependency produced by a composite or included build, or resolved from a local repo cache), then calls initProjectModuleAndBuildPaths, where project == null because findProject did not locate a Project matching the artifact's group/name.
Common situations: Composite/included builds where the artifact comes from an included build not visible via project lookup; artifacts with classifier or custom name mapping that breaks group:name matching; stale Gradle caches after renaming a module; dependencies published from another repo with the same coordinates as a local module.
Related errors
- Could not resolve POM for
- Failed to resolve ${appArtifact}
- Failed to import platform properties
- did not resolve to any artifacts
- because the project does not have any source set / among the
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/8f60ea238ca309e9.
Report an issue: GitHub.