We tried to migrate our build scripts from Groovy and Kotlin and it raised several questions that we couldn’t answer. Can you please help?
In Groovy we have the following block:
eclipse { classpath { downloadSources=true }}
I assume that we can leave it as is in Kotlin version but it gives us compliation error:
Cannot access 'downloadSources': it is private in 'EclipseClasspath'
But we couldn’t find any API that changes this property. Is it possible to adjust it?
In the root build.gradle.kts we declared Java plugin:
plugins { java }
But we also had to declare it in build.gradle.kts in each-subproject otherwise it didn’t compile. Is it possible not to re-declare all the plugins in sub-projects?
Thanks for your reply, @Strannik. Indeed this solution works in that sense, that with plugins { java } you add the “Java” Plugin to the Root-Project and set the properties in the root project.
I tested and indeed the sourceCompability settings are then successfully inherited to the subprojects.
Nevertheless this adds java-Plugin Properties to the parent project and I’m note sure if this is desirable as the parent project is a pure umbrella projects and should i.e. not have itself a src/main/java-Directory etc.
When doing configuration injection from a project to another (here from the root to children), type-safe accessors are not available and you need to rely on the API. The following should work: