quarkusio/quarkus · error · IllegalStateException

Failed to resolve deployment classpath

Error message

Failed to resolve deployment classpath

What it means

BeforeTestAction.execute wraps any failure while preparing the deployment classpath (application model resolution, extension config, native runner path, test-to-main mappings) into IllegalStateException with message 'Failed to resolve deployment classpath'.

Source

Thrown at devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/actions/BeforeTestAction.java:100

            final File outputDirectoryAsFile = getLastFile(mainSourceSetClassesDir);

            Path projectDirPath = projectDir.toPath();

            // Identify the folder containing the sources associated with this test task
            String fileList = task.getTestClassesDirs().getFiles().stream()
                    .filter(File::exists)
                    .distinct()
                    .map(testSrcDir -> String.format("%s:%s",
                            projectDirPath.relativize(testSrcDir.toPath()),
                            projectDirPath.relativize(outputDirectoryAsFile.toPath())))
                    .collect(Collectors.joining(","));
            task.environment(BootstrapConstants.TEST_TO_MAIN_MAPPINGS, fileList);
            task.getLogger().debug("test dir mapping - {}", fileList);

            String nativeRunner = nativeRunnerPath.get().toPath().toAbsolutePath().toString();
            props.put("native.image.path", nativeRunner);
        } catch (Exception e) {
            throw new IllegalStateException("Failed to resolve deployment classpath", e);
        }
    }

    private EffectiveConfigProvider effectiveProvider() {
        return new EffectiveConfigProvider(
                extensionView.getIgnoredEntries(),
                extensionView.getMainResources(),
                extensionView.getForcedProperties(),
                extensionView.getProjectProperties(),
                extensionView.getQuarkusBuildProperties(),
                manifestAttributes,
                manifestSections,
                extensionView.getNativeBuild(),
                extensionView.getQuarkusProfileSystemVariable(),
                extensionView.getQuarkusProfileEnvVariable());
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Read the wrapped cause (e.getCause()) for the underlying resolution/model failure
  2. Run ./gradlew build --refresh-dependencies and confirm repositories are reachable; verify plugin and Quarkus platform versions match
  3. For native mode, verify GraalVM native-image is installed and quarkus.native.* settings are correct
Defensive patterns

Strategy: try-catch

Validate before calling

// before tests: ./gradlew dependencies --configuration <deploymentClasspath> and confirm resolution succeeds
tasks.test { dependsOn("dependencies") } // fail fast on unresolvable deps

Try / catch

try { /* run quarkus tests */ } catch (IllegalStateException e) { if ("Failed to resolve deployment classpath".equals(e.getMessage())) { log.error("underlying: ", e.getCause()); } }

Prevention

When it happens

Trigger: Running Quarkus tests via the Gradle test action when building the ApplicationDeploymentClasspathBuilder results (dependency resolution failure, invalid application model, missing config, or native runner path unavailable in native-test mode).

Common situations: Unresolvable deployment dependencies (repositories/offline), broken quarkus plugin extension config, version mismatch between Gradle plugin and Quarkus core, missing native-image binary when running native tests.

Related errors


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