Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugins using kotlin-dsl and compiled with 6.1 are incompatible with Gradle 6.0 #11947

JasonMing opened this issue Jan 20, 2020 · 1 comment


Copy link

@JasonMing JasonMing commented Jan 20, 2020

Expected Behavior

Build still works

Current Behavior

Build failed


The compiled plugin with kotlin-dsl repository { ... } in buildscript{ ... } block use gradle 6.0.1 are broken in gradle 6.1.

Steps to Reproduce

  1. Compile plugin use gradle 6.0.1

    class FooGradlePlugin : Plugin<Gradle> {
        override fun apply(target: Gradle) {
            target.beforeProject {
                buildscript {
                    repositories { // <<= This block is actually call `org.gradle.kotlin.dsl.ProjectExtensions.repositories(...)`
                        // configure repository here
  2. Apply the plugin in gradle 6.1

  3. Report error

    Caused by: java.lang.NoSuchMethodError: org.gradle.kotlin.dsl.ProjectExtensionsKt.repositories(Lorg/gradle/api/initialization/dsl/ScriptHandler;Lkotlin/jvm/functions/Function1;)V


In gradle 6.1 the extension method ScriptHandler.repositories(configuration: RepositoryHandler.() -> Unit) moved from file org/gradle/kotlin/dsl/ProjectExtensions.kt to org/gradle/kotlin/dsl/ScriptHandlerExtensions.kt.

This causes the generated class name is changed.

Copy link

@ljacomet ljacomet commented Jan 20, 2020

Thanks for the report, that is a mistake made in a change for Gradle 6.1 in #11425

Looking at options for taking care of this.

@big-guy big-guy added this to the 6.1.1 milestone Jan 21, 2020
@big-guy big-guy changed the title Compiled plugins with kotlin-dsl repository{} in buildscript block are broken since 6.1 Plugins using kotlin-dsl and compiled with 6.1 are incompatible with Gradle 6.0 Jan 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

3 participants