Hi!
I’m upgrading (6.x->7.6) a multi-project gradle repository. I have a subproject that has had a dependency declaration like the following:
dependencies {
compile libs.hdrhistogram
compile libs.yetusAnnotations
provided libs.scalaLibrary
provided libs.sparkCore
provided libs.sparkSql
provided libs.slf4jApi
testCompile libs.junit
testCompile libs.scalatest
testCompile libs.log4jApi
testCompile libs.log4jCore
testCompile libs.log4jSlf4jImpl
}
Based on the upgrade guide (Upgrading your build from Gradle 6.x to 7.0) and the maven migration guide (Migrating Builds From Apache Maven) I changed the dependencies to as follows:
dependencies {
implementation libs.hdrhistogram
implementation libs.yetusAnnotations
implementation libs.scalaLibrary
implementation libs.sparkCore
implementation libs.sparkSql
implementation libs.slf4jApi
testImplementation libs.junit
testImplementation libs.scalatest
testImplementation libs.log4jApi
testImplementation libs.log4jCore
testImplementation libs.log4jSlf4jImpl
}
Unfortunately the project doesn’t compile when setting the provided dependencies to compileOnly.
The problem comes when I inspect the contents of the created jar. Previously the generated jar did not include the scala/spark/slf4j classes, however after the change the jar size has exploded from 17Mb to 130Mb. Try as I might I can’t really find a simple way to define depenencies to be used during compile, but exclude during the jar task. Am I missing something, or should I use a specific plugin for this?