Skip to content

Commit ed3f2e7

Browse files
committed
Properly handle gradle include build null project in dependency collection
Ensure that `initProjectModuleAndBuildPaths` throws an `IllegalStateException` with a clear message if the provided Gradle `Project` is null. This will help in diagnosing issues related to missing projects when resolving dependencies in Gradle builds, especially in the context of included builds.
1 parent d72b94a commit ed3f2e7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/tooling/GradleApplicationModelBuilder.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,10 @@ private void collectDependencies(org.gradle.api.artifacts.ResolvedDependency res
518518

519519
private void initProjectModuleAndBuildPaths(final Project project,
520520
ResolvedArtifact resolvedArtifact, ApplicationModelBuilder appModel, final ResolvedDependencyBuilder appDep) {
521-
521+
if (project == null) {
522+
System.err.println("Error: could not find project for " + resolvedArtifact.getId().getDisplayName());
523+
throw new IllegalStateException("Could not find project for " + resolvedArtifact.getId().getDisplayName());
524+
}
522525
appDep.setWorkspaceModule().setReloadable();
523526

524527
if (appDep.getWorkspaceModule() == null) {

0 commit comments

Comments
 (0)