using gradle 4.1-rc-2 with the `kotlin-dsl` plugin...
# gradle
f
using gradle 4.1-rc-2 with the
kotlin-dsl
plugin, anything I’m missing here?
j
Do this instead:
Copy code
repositories {
    maven {
        setUrl("https://...")
    }
}
f
Doesn’t like that either
Copy code
org/gradle/kotlin/dsl/ProjectExtensionsKt
java.lang.NoClassDefFoundError: org/gradle/kotlin/dsl/ProjectExtensionsKt
j
Really?!?!
Huh.... Is this in a build.gradle.kts file or a plugin?
Did you use the
kotlin-dsl
plugin if you are writing a plugin?
f
Writing a custom plugin, this is in
src/main/kotlin
Copy code
plugins {
    `java-gradle-plugin`
    `kotlin-dsl`
    `maven-publish`
}
Gradle 4.1-rc-2
j
Hrm.
Did you add a dependency on the
gradleKotlinApi()
? I don't know if that's nessasry
@bamboo?
Ooooh maybe it's the sam plugin?
b
It is the sam plugin. It’s not taken into account by the IDE yet (https://github.com/gradle/kotlin-dsl/issues/373)
We’ll fix it once Kotlin 1.1.4 is out
f
cool, thanks
@bamboo Does this look like the same thing?
Copy code
org/gradle/kotlin/dsl/NamedDomainObjectContainerScope
java.lang.NoClassDefFoundError: org/gradle/kotlin/dsl/NamedDomainObjectContainerScope
Copy code
override fun apply(project: Project) {
        applyRequiredPlugins(project)
        val config = configureMobiusCommonResourcesConfiguration(project)

        project.run {
            tasks {
                val copyCertsToDockerDir by creating(Copy::class) {
                    group = MobiusBasePlugin.mobius
                    dependsOn(config)
                    from(config.map { zipTree(it) })
                    include("truststore")
                    include("keystore")
                    into(dockerDirectory)
                }
                val copyJarToDockerDir by creating(Copy::class) {
                    group = MobiusBasePlugin.mobius
                    dependsOn(tasks.getByName("build"))
                    from(tasks.getByName("jar"))
                    into(dockerDirectory)
                }
                val buildDockerImage by creating(Exec::class) {
                    group = MobiusBasePlugin.mobius
                    dependsOn("copyCertsToDOckerDir")
                    dependsOn("copyJarToDockerDir")
                    commandLine("docker", "build", "-t", getDockerImage(project), "--build-arg", "maven_version=${project.version}", dockerDirectory)
                }
            }
        }
    }
b
that exception is something else, how do you get it?
f
by applying the plugin
no idea
Copy code
class MobiusDockerPluginTest {

    val project: Project = ProjectBuilder.builder().build()

    init {
        project.plugins.apply(MobiusDockerPlugin::class.java)
    }
blows up in init
b
ah, you get it on the test only?
f
not sure, I don’t have the project set use outside of tests yet
but the test is definitely blowing up
b
ok, that’s probably a missing
testRuntime
dependency on
gradleKotlinDsl()
the
kotlin-dsl
adds a
compileOnly
dependency because the API is provided by the Gradle environment
ProjectBuilder
doesn’t support it out of the box though
f
yep, that does it
testCompile(gradleKotlinDsl())
b
Can you please try adding this dependency to your plugin project?
testRuntime(gradleKotlinDsl())
cool
f
testRuntime
works as well
b
👍
f
is that something that makes sense to add the the
kotlin-dsl
plugin?
b
Could you please file an issue so we can make testing work out of the box?
yes, definitely
f
sure
thanks again!
b
👍