quarkusio/quarkus · error · GradleException
Failed to configure ${taskPath}: sourceSet ${sourceSet} has
Error message
Failed to configure ${taskPath}: sourceSet ${sourceSet} has no output What it means
configureGenerateCodeTask throws GradleException when the source set backing Quarkus code generation produces no output directory matching the generate-sources directory name, so the generateCode task cannot be wired up.
Source
Thrown at devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java:687
.cachingRelevantProperties(quarkusExt.getCachingRelevantProperties().get()));
task.getJarEnabled().set(quarkusExt.packageConfig().jar().enabled());
task.getNativeEnabled().set(quarkusExt.nativeConfig().enabled());
task.getNativeSourcesOnly().set(quarkusExt.nativeConfig().sourcesOnly());
task.getRunnerSuffix().set(quarkusExt.packageConfig().computedRunnerSuffix());
task.getRunnerName().set(quarkusExt.packageConfig().outputName());
task.getOutputDirectory().set(quarkusExt.packageConfig().outputDirectory());
task.getJarType().set(quarkusExt.packageConfig().jar().type());
task.getManifestAttributes().set(quarkusExt.manifest().getAttributes());
task.getManifestSections().set(quarkusExt.manifest().getSections());
}
private static void configureGenerateCodeTask(QuarkusGenerateCode task,
TaskProvider<QuarkusApplicationModelTask> applicationModelTaskTaskProvider, String generateSourcesDir,
QuarkusPluginExtension quarkusExt) {
SourceSet generatedSources = getSourceSet(task.getProject(), generateSourcesDir);
Set<File> sourceSetOutput = generatedSources.getOutput().filter(f -> f.getName().equals(generateSourcesDir)).getFiles();
if (sourceSetOutput.isEmpty()) {
throw new GradleException("Failed to configure " + task.getPath() + ": sourceSet " + generateSourcesDir
+ " has no output");
}
task.getApplicationModel()
.set(applicationModelTaskTaskProvider.flatMap(QuarkusApplicationModelTask::getApplicationModel));
task.getGeneratedOutputDirectory().set(generatedSources.getJava().getClassesDirectory());
task.getCachingRelevantInput()
.set(quarkusExt.cachingRelevantProperties(quarkusExt.getCachingRelevantProperties().get()));
task.getManifestAttributes().set(quarkusExt.manifest().getAttributes());
task.getManifestSections().set(quarkusExt.manifest().getSections());
}
private void createSourceSets(Project project) {
SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class);
sourceSets.create(INTEGRATION_TEST_SOURCE_SET_NAME);
sourceSets.create(NATIVE_TEST_SOURCE_SET_NAME);
sourceSets.create(QuarkusGenerateCode.QUARKUS_GENERATED_SOURCES);
sourceSets.create(QuarkusGenerateCode.QUARKUS_TEST_GENERATED_SOURCES);
}View on GitHub (pinned to e1c734241f)
Solutions
- Do not remove or rename the generated-sources source set created by the Quarkus plugin
- Verify sourceSets configuration keeps the generated sources output (sourceSets { main { ... } } customizations must not delete it)
- Check quarkusExt settings / generateSourcesDir value matches the actual source set name
Example fix
// before (custom build logic)
sourceSets.removeIf { it.name == "quarkusGeneratedSources" }
// after
// keep the source set; only append extra srcDirs
sourceSets.matching { it.name == "quarkusGeneratedSources" }.configureEach {
java.srcDir("extra-generated")
} Defensive patterns
Strategy: validation
Validate before calling
Set<File> out = project.getExtensions().getByType(SourceSetContainer.class)
.getByName("quarkusGeneratedSources").getOutput().getFiles();
if (out.isEmpty()) { throw new IllegalStateException("generated sources source set has no output"); } Try / catch
try { /* build */ } catch (GradleException e) { if (e.getMessage().contains("has no output")) { /* restore source set config */ } } Prevention
- Don't remove/rename the plugin's generated-sources source set
- Only extend source sets (srcDir), never replace output config
- Verify generateSourcesDir name matches the actual source set
When it happens
Trigger: Registering/configuring a QuarkusGenerateCode task where getSourceSet(project, generateSourcesDir).getOutput() yields no File named generateSourcesDir — typically when the generated-sources source set was removed, renamed, or not created by the plugin extension.
Common situations: Custom build logic overriding or removing the 'quarkusGeneratedSources'-style source set; source set output reconfigured (custom classes dirs); applying the Quarkus plugin to a project with heavily customized source set layout.
Related errors
- because the project does not have any source set / among the
- Failed to load CodeGenProvider class from deployment classlo
- Failed to load application configuration
- Failed to create output directory for generated sources: %s
- Failed to resolve ${appArtifact}
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/cd1b66ff697720f1.
Report an issue: GitHub.