quarkusio/quarkus · error · GradleException

Mixed DSL is not supported. Both build and settings file nee

Error message

Mixed DSL is not supported. Both build and settings file need to use either Kotlin or Groovy DSL

What it means

getQuarkusProject inspects the root settings file and the project's build file to pick a matching GradleProjectBuildFile (Kotlin or Groovy). If the settings and build files use different DSLs (e.g. settings.gradle.kts with build.gradle, or vice versa), it throws GradleException("Mixed DSL is not supported...") because the tooling cannot parse the project consistently.

Source

Thrown at devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusPlatformTask.java:147

        return quarkusCoreVersion;
    }

    protected QuarkusProject getQuarkusProject(boolean limitExtensionsToImportedPlatforms) {
        final GradleMessageWriter log = messageWriter();
        final ExtensionCatalog catalog = extensionsCatalog(limitExtensionsToImportedPlatforms, log);

        final Path projectDirPath = project.getProjectDir().toPath();
        final Path rootProjectPath = project.getParent() != null ? project.getRootProject().getProjectDir().toPath()
                : projectDirPath;
        final BuildFile buildFile;
        if (Files.exists(rootProjectPath.resolve("settings.gradle.kts"))
                && Files.exists(projectDirPath.resolve("build.gradle.kts"))) {
            buildFile = new GradleKotlinProjectBuildFile(project, catalog);
        } else if (Files.exists(rootProjectPath.resolve("settings.gradle"))
                && Files.exists(projectDirPath.resolve("build.gradle"))) {
            buildFile = new GradleGroovyProjectBuildFile(project, catalog);
        } else {
            throw new GradleException(
                    "Mixed DSL is not supported. Both build and settings file need to use either Kotlin or Groovy DSL");
        }
        final JavaVersion javaVersion = resolveProjectJavaVersion();
        return QuarkusProjectHelper.getProject(project.getProjectDir().toPath(), catalog, buildFile, javaVersion, log);
    }

    private JavaVersion resolveProjectJavaVersion() {
        TaskCollection<JavaCompile> compileTasks = project.getTasks().withType(JavaCompile.class);
        if (compileTasks.isEmpty()) {
            return JavaVersion.NA;
        }
        final JavaCompile task = compileTasks.iterator().next();
        return new JavaVersion(task.getTargetCompatibility());
    }

    protected GradleMessageWriter messageWriter() {
        return new GradleMessageWriter(getLogger());
    }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Make the DSL consistent: use settings.gradle.kts with build.gradle.kts (Kotlin), or settings.gradle with build.gradle (Groovy).
  2. Rename the offending file — e.g. convert settings.gradle to settings.gradle.kts if the build file is Kotlin.
  3. Temporarily create both files in the same DSL if third-party tooling requires the other format.

Example fix

// before
settings.gradle.kts  +  build.gradle

// after
settings.gradle.kts  +  build.gradle.kts
Defensive patterns

Strategy: validation

Validate before calling

// verify DSL consistency before running Quarkus tasks
def root = project.rootDir
def kts = file("${root}/settings.gradle.kts").exists()
def groovy = file("${root}/settings.gradle").exists()
def buildKts = file("build.gradle.kts").exists()
def buildGroovy = file("build.gradle").exists()
assert (kts == buildKts) || (groovy && buildGroovy) : 'Mixed DSL: settings and build files must use the same DSL'

Try / catch

try { getQuarkusProject() } catch (GradleException e) { if (e.message.contains('Mixed DSL is not supported')) { /* rename build.gradle <-> build.gradle.kts to match settings */ } }

Prevention

When it happens

Trigger: Running any Quarkus Gradle task requiring a QuarkusProject when one of these file pairs exists: settings.gradle + build.gradle.kts, or settings.gradle.kts + build.gradle (and neither of the supported combinations).

Common situations: Teams migrating Gradle builds to Kotlin DSL incrementally; devs adding build.gradle.kts alongside legacy settings.gradle; copied snippets mixing DSLs.

Related errors


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