Moving an old multi-project build from the Groovy DSL to the Kotlin DSL. The root build.gradle had this block.
subprojects {
apply plugin: 'java-library'
repositories { mavenCentral() }
}
The root I converted mechanically.
subprojects {
apply(plugin = "java-library")
repositories { mavenCentral() }
}
In order, then.
The root script compiles. No problem there.
In the subproject core/build.gradle.kts, the line implementation(project(":util")) inside dependencies stops script compilation with an unresolved reference to implementation. The same line worked under Groovy.
Case three is the one I can't explain. Put plugins { id("java-library") } at the top of that same file and the error goes away, even though the root was already applying the plugin. Same plugin, same project, so why do only the accessors disappear? And is repeating a plugins block in every subproject really the intended fix?