https://kotlinlang.org logo
#gradle
Title
# gradle
i

Ido Flax

01/26/2023, 4:27 PM
Another more urgent question, i suddenly started getting
Copy code
Execution failed for task ':compileKotlin'.
> Default Kotlin compiler classpath is empty! Task: :compileKotlin (org.jetbrains.kotlin.gradle.tasks.KotlinCompile_Decorated)
And i can’t figure out why and what it means. Can anyone help?
s

Sam

01/26/2023, 4:45 PM
The error suggests that the Kotlin Gradle plugin hasn’t been properly applied to the project. Did you change anything in your build script(s) recently?
Normally the compiler classpath is populated here when the plugin is applied. The only way it should be able to end up empty is if the plugin’s
apply
method never ran.
i

Ido Flax

01/27/2023, 1:11 AM
I did change some things, but nothing that doesn’t make sense. I just debugged it, this line is defiantly hit, still getting that error
Screenshot 2023-01-27 at 06.42.17.png
Screenshot 2023-01-27 at 06.43.09.png
Screenshot 2023-01-27 at 06.44.37.png
I’m on kotlin 1.7.10 btw
gradle 7.5.1
line 105 is never hit though, could this be the issue?
I found the issue, it was because of a change to how i impose my platforms, i changed it from imposing them on just the implementation configuration, i impose them on all configurations. So this includes the
kotlinCompilerClasspath
configuration, which messed things up. So now i filter it out. Before: (broken)
Copy code
DependencyHandlerScope.of(dependencies).let { dependencyHandlerScope ->
            configurations.all {
                dependencyHandlerScope.add(
                    name,
                    dependencyHandlerScope.platform("com.me.infra:me-starter-parent:$infraPlatform")
                )
                dependencyHandlerScope.add(
                    name,
                    dependencyHandlerScope.platform("<http://com.me:platform:$platform|com.me:platform:$platform>")
                )
            }
        }
After: (works)
Copy code
DependencyHandlerScope.of(dependencies).let { dependencyHandlerScope ->
            configurations.filter { it.name != "kotlinCompilerClasspath" }.forEach {
                dependencyHandlerScope.add(
                    it.name,
                    dependencyHandlerScope.platform("com.me.infra:me-starter-parent:$infraPlatform")
                )
                dependencyHandlerScope.add(
                    it.name,
                    dependencyHandlerScope.platform("<http://com.me:platform:$platform|com.me:platform:$platform>")
                )
            }
        }
@Sam thanks for your advice
11 Views