quarkusio/quarkus · error · IllegalStateException

Failed to determine the Quarkus core version for the project

Error message

Failed to determine the Quarkus core version for the project

What it means

Thrown by GradleUtils.getQuarkusCoreVersion when resolution of the project's BOM configurations cannot determine which quarkus-core artifact version applies. The method builds a detached configuration from the declared platform BOMs and inspects the resolution strategy for the quarkus-core dependency to extract the version; if that dependency never appears during resolution (wrong or incomplete platform import), the version reference stays unset and this error fires.

Source

Thrown at devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/GradleUtils.java:42

        final List<Dependency> bomDeps = listProjectBoms(project);
        if (bomDeps.isEmpty()) {
            throw new GradleException("No platforms detected in the project");
        }

        final Configuration boms = project.getConfigurations()
                .detachedConfiguration(bomDeps.toArray(new org.gradle.api.artifacts.Dependency[0]));

        final AtomicReference<String> quarkusVersionRef = new AtomicReference<>();
        boms.getResolutionStrategy().eachDependency(d -> {
            if (quarkusVersionRef.get() == null && d.getTarget().getName().equals("quarkus-core")
                    && d.getTarget().getGroup().equals("io.quarkus")) {
                quarkusVersionRef.set(d.getTarget().getVersion());
            }
        });
        boms.getResolvedConfiguration();
        final String quarkusCoreVersion = quarkusVersionRef.get();
        if (quarkusCoreVersion == null) {
            throw new IllegalStateException("Failed to determine the Quarkus core version for the project");
        }
        return quarkusCoreVersion;
    }

    public static List<Dependency> listProjectBoms(Project project) {
        final Configuration impl = project.getConfigurations().getByName(JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME);
        List<Dependency> boms = new ArrayList<>();
        impl.getIncoming().getDependencies()
                .forEach(d -> {
                    if (!(d instanceof ModuleDependency)) {
                        return;
                    }
                    final ModuleDependency module = (ModuleDependency) d;
                    final Category category = module.getAttributes().getAttribute(Category.CATEGORY_ATTRIBUTE);
                    if (category != null
                            && (Category.ENFORCED_PLATFORM.equals(category.getName())
                                    || Category.REGULAR_PLATFORM.equals(category.getName()))) {
                        boms.add(d);

View on GitHub (pinned to e1c734241f)

Solutions

  1. Ensure the standard Quarkus platform BOM (io.quarkus.platform:quarkus-bom) is imported, not only a custom BOM
  2. Check the resolved BOM actually pins io.quarkus:quarkus-core; pin the core version explicitly if needed
  3. Inspect listProjectBoms(project) output to confirm which BOMs are detected

Example fix

// before
implementation platform("com.example:my-own-bom:1.0") // no quarkus platform
// after
implementation enforcedPlatform("io.quarkus.platform:quarkus-bom:3.x.y")
Defensive patterns

Strategy: validation

Validate before calling

if (GradleUtils.listProjectBoms(project).stream()
        .noneMatch(d -> d.getGroup().contains("quarkus"))) {
    throw new IllegalStateException("Quarkus platform BOM not imported");
}

Try / catch

try { v = GradleUtils.getQuarkusCoreVersion(project); } catch (IllegalStateException e) { /* BOMs resolved but no quarkus-core version found */ }

Prevention

When it happens

Trigger: listProjectBoms returned BOMs, the detached configuration resolved, but none of the resolved BOM descriptors identified the Quarkus core version (e.g. a custom/non-Quarkus BOM only, or resolution silently skipped descriptors).

Common situations: Using a custom platform BOM that doesn't reference io.quarkus:quarkus-core; dependency resolution reduced to metadata only; unusual BOM import syntax that GradleUtils' dependency-inspection doesn't recognize.

Related errors


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