Hello, I’ve been trying to move common details of ...
# android
g
Hello, I’ve been trying to move common details of my android lib modules to a specific plugin defined in
buildSrc
. Using Kotlin along with the
kotlin-dsl
for gradle i’ve been able to move pretty much everything except for the following excerpt:
Copy code
android {
    kotlinOptions {
        jvmTarget = "1.8"
    }
}
The
kotlinOptions
isn’t visible from the extensions within
buildSrc
sourceset, probably because I don’t implement the dsl? I’ve tried doing the following, but it didn’t work
Copy code
target.tasks.withType(KotlinCompile::class.java).forEach { task ->
    task.kotlinOptions.jvmTarget = "1.8"
}
i
https://github.com/gradle/kotlin-dsl-samples/issues/1368 It should be fixed. Is everything updated to the latest version?
You can also try.
Copy code
(this as ExtensionAware).configure<KotlinJvmOptions> {
        jvmTarget = "1.8"
    }
👍 1
Or
Copy code
withGroovyBuilder {
        "kotlinOptions" {
            setProperty("jvmTarget", "1.8")
        }
    }
g
ExtensionAware worked, ty!