quarkusio/quarkus · error · GradleException

Unable to serialiaze gradle application model

Error message

Unable to serialiaze gradle application model

What it means

Thrown by QuarkusExtensionPlugin.registerTasks when serializing the Gradle application model for a Quarkus test task fails with an IOException. The serialized model path is passed to test JVMs via the SERIALIZED_TEST_APP_MODEL system property so they can bootstrap the application; without it test tasks cannot start.

Source

Thrown at devtools/gradle/gradle-extension-plugin/src/main/java/io/quarkus/extension/gradle/QuarkusExtensionPlugin.java:120

                        deploymentClasspath.setTransitive(true);
                        // Add project dependency on deployment module
                        project.getDependencies().add(DEPLOYMENT_CLASSPATH_CONFIGURATION_NAME,
                                project.getDependencies().project(
                                        java.util.Map.of("path", deploymentProject.getPath())));
                    }
                    task.setDeploymentModuleClasspath(deploymentClasspath);
                });

                deploymentProject.getTasks().withType(Test.class).configureEach(test -> {
                    test.useJUnitPlatform();
                    test.doFirst(task -> {
                        final Map<String, Object> props = test.getSystemProperties();
                        final ApplicationModel appModel = ToolingUtils.create(deploymentProject, LaunchMode.TEST);
                        try {
                            final Path serializedModel = ToolingUtils.serializeAppModel(appModel, task, true);
                            props.put(BootstrapConstants.SERIALIZED_TEST_APP_MODEL, serializedModel.toString());
                        } catch (IOException e) {
                            throw new GradleException("Unable to serialiaze gradle application model", e);
                        }
                    });
                });
                if (ApplicationDeploymentClasspathBuilder.isDisableComponentVariants(project)) {
                    // This seems to override the deployment configuration that otherwise would be created
                    // by the ApplicationDeploymentClasspathBuilder, which will not work
                    // especially for the component variant-based approach.
                    exportDeploymentClasspath(deploymentProject);
                }
            }
        });
    }

    private void exportDeploymentClasspath(Project project) {
        DeploymentClasspathBuilder deploymentClasspathBuilder = new DeploymentClasspathBuilder(project);
        project.getConfigurations().getByName(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME).getIncoming()
                .beforeResolve((dependencies) -> deploymentClasspathBuilder
                        .exportDeploymentClasspath(JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME, LaunchMode.NORMAL));

View on GitHub (pinned to e1c734241f)

Solutions

  1. Run gradle clean (or delete the project's build directory) and rebuild to clear stale/locked output.
  2. Check disk space and that the build directory is writable by the user running Gradle.
  3. Invalidate Gradle caches / restart the daemon (./gradlew --stop) if a stale daemon holds file handles.
  4. If caused by a tooling bug, capture the wrapped IOException (GradleException cause) and report with plugin version.

Example fix

// before
./gradlew quarkusTest
// after: clean state and retry
./gradlew --stop && ./gradlew clean quarkusTest
Defensive patterns

Strategy: validation

Validate before calling

// before running Quarkus Gradle tests
def buildDir = project.buildDir
if (!buildDir.canWrite()) throw new IllegalStateException("Build dir not writable: $buildDir")
if (buildDir.usableSpace < 100L * 1024 * 1024) throw new IllegalStateException('Less than 100MB free on build volume')

Prevention

When it happens

Trigger: ToolingUtils.serializeAppModel(appModel, task, true) throws IOException while writing the model file next to the task's temporary directory — e.g. the target file cannot be created because the build directory is missing, read-only, or the disk is full.

Common situations: CI environments with read-only or full workspace disks, builds where the project build directory was deleted/locked mid-configuration, or permission issues after running builds with different users.

Related errors


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