Another more urgent question, i suddenly started g...
# gradle
i
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
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
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