cbeust / kobalt

A Kotlin-based build system for the JVM.
Apache License 2.0
432 stars 60 forks source link

Plugins fatJar are full of unneeded dependencies (documentation & bug) #432

Closed ethauvin closed 7 years ago

ethauvin commented 7 years ago

Per the docs:

    dependencies {
        compile("org.apache.maven:maven-settings-builder:3.3.9")
        compile("com.beust:$kobaltDependency:")
    }

    dependenciesTest {
        compile("org.testng:testng:")

    }

2017-04-26 15_21_08-c__users_erik_desktop_tmp2_kobalt-maven-local-0 5 3 jar_com_

Looks like it's including the kobalt-api dependencies, which does make sense. The solution, which was not available until recently, is to use:

    dependencies {
        compile("org.apache.maven:maven-settings-builder:3.3.9")
        compileOnly("com.beust:$kobaltDependency:")
}

2017-04-26 15_30_37-k__kotlin_kobalt-maven-local_kobaltbuild_libs_kobalt-maven-local-0 5 3 jar_ Looks better, except for the kotlin directory.

cbeust commented 7 years ago

Ok to close this issue since we established in Slack that kotlin is kotlin-stdlib, which is pulled by kobalt-plugin-api?

ethauvin commented 7 years ago

I don't think so. compileOnly excludes the kobalt-plugin-api and its dependencies. It works, everything is gone from fatJar, except for the kotlin-stdlib in the kotlin directory.

cbeust commented 7 years ago

Working as intended:

            // All Kotlin projects automatically get the Kotlin runtime added to their class path
            listOf(kotlinJarFiles.stdlib, kotlinJarFiles.runtime)
                    .map { FileDependency(it.absolutePath) }

Closing per our Slack conversation.