quarkusio/quarkus · error · RuntimeException

because the project does not have any source set / among the

Error message

because the project does not have any source set / among the following source sets:

What it means

Thrown by GradleApplicationModelBuilder.processDeploymentDependency when a Quarkus deployment dependency (artifactId ending in -deployment) resolves to a Gradle project whose source sets contain no match for the required source set. The builder needs to associate the deployment artifact with a source set of the main application project; when none exists or none of the available source sets can be matched, it aborts with a RuntimeException listing the source sets it inspected. This indicates the Gradle project structure is inconsistent with what Quarkus expects.

Source

Thrown at devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/tooling/GradleApplicationModelBuilder.java:313

                    SourceSetContainer sourceSets = projectDep.getExtensions().getByType(SourceSetContainer.class);

                    SourceSet mainSourceSet = sourceSets.findByName(SourceSet.MAIN_SOURCE_SET_NAME);
                    if (mainSourceSet == null) {
                        // try Kotlin multiplatform
                        mainSourceSet = sourceSets.findByName("jvmMain");
                        if (mainSourceSet == null) {
                            var msg = new StringBuilder()
                                    .append("Failed to determine the main source set of ").append(projectDep.getPath());
                            var i = sourceSets.iterator();
                            if (!i.hasNext()) {
                                msg.append(" because the project does not have any source set");
                            } else {
                                msg.append(" among the following source sets: ").append(i.next().getName());
                                while (i.hasNext()) {
                                    msg.append(", ").append(i.next().getName());
                                }
                            }
                            throw new RuntimeException(msg.toString());
                        }
                    }
                    dep = toDependency(a, mainSourceSet);
                    modelBuilder.addDependency(dep);
                } else if (isDependency(a)) {
                    dep = toDependency(a);
                    modelBuilder.addDependency(dep);
                }
                if (dep != null) {
                    modelBuilder.addDependency(dep);
                    clearReloadableFlag = true;
                }
            }
            if (dep != null) {
                if (dep.isRuntimeExtensionArtifact()) {
                    clearReloadableFlag = true;
                }
                dep.setDeploymentCp();

View on GitHub (pinned to e1c734241f)

Solutions

  1. Ensure the subproject providing the Quarkus extension has a 'main' source set (apply the java/kotlin plugin and keep the default source set intact).
  2. Check which source sets are listed in the message; add or rename your source set so it matches what the Quarkus Gradle plugin expects.
  3. Verify the deployment dependency (artifactId-suffix '-deployment') points to the intended project in your Gradle dependency declarations.
  4. Align the Quarkus Gradle plugin version with your Quarkus platform/BOM version to avoid mismatched model-building assumptions.
  5. Run with --stacktrace/-Dorg.gradle.debug to confirm which dependency triggers it and fix that module's configuration.

Example fix

// before (build.gradle of a subproject with no java plugin)
plugins { id 'io.quarkus' }
// after
plugins { id 'java'; id 'io.quarkus' }
sourceSets { main { java { srcDirs 'src/main/java' } } }
Defensive patterns

Strategy: validation

Validate before calling

// In your Gradle build, before invoking Quarkus tasks:
def ss = project.sourceSets.findByName('main')
if (ss == null) throw new GradleException("Project ${project.name} has no 'main' source set required by the Quarkus Gradle plugin")

Try / catch

try {
    quarkusBuild()
} catch (RuntimeException e) {
    if (e.message?.contains('among the following source sets')) {
        logger.error('Quarkus deployment dependency could not be mapped to a source set: ' + e.message)
    } else throw e
}

Prevention

When it happens

Trigger: Running a Quarkus Gradle build (quarkusDev, quarkusBuild, or the model-building phase) where collectExtensionDependencies walks deployment dependencies and calls processDeploymentDependency on a project dependency that has no matching source set — e.g. the deployment artifact maps to a project whose main source set was not created, or the required source set name does not exist among the project's source sets.

Common situations: Multi-project Gradle builds where a library subproject's quarkus deployment dependency is wired to the wrong project; custom source set configurations (renaming/removing the 'main' source set); applying the Quarkus plugin in a project with no Java/Kotlin source sets; version mismatches between quarkus-gradle-plugin and the Quarkus BOM where deployment artifact naming assumptions break.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/09e45294e6542df7. Report an issue: GitHub.