I am trying to construct a configuration based on the implementation configuration.
My goal is to ‘implement’ a number of dependencies which I want to include in an uberjar but suppress all of their transitive dependencies.
From the manual
val uberJarImplementation by configurations.creating {
extendsFrom(configurations.implementation.get())
}
dependencies {
testImplementation("junit:junit:4.12")
uberJarImplementation("org.apache.httpcomponents:httpclient:4.5.5")
}
This results in compilation errors about packages and symbols from the depencency not being found.
Changing to the following clears up the problem
val uberJarImlementation by configurations.creating {
extendsFrom(configurations.implementation.get())
}
dependencies {
testImplementation("junit:junit:4.12")
implementation("org.apache.httpcomponents:httpclient:4.5.5")
uberJarImplementation("org.apache.httpcomponents:httpclient:4.5.5")
}
The behavior is as expected when using groovy as the gradle scripting language.
Where is the error?
I have made a simple hello world style project that illustrates the issue.
It does this by depending on the JCommander command line processor.
[[
git clone https://github.com/phreed/kotlin-gradle-demo
cd kotlin-gradle-demo
./gradlew run
]] will illustrate the issue.
The repository also has a couple of branches that seem to work as expected.
However I am not convinced they are correct.