I need to exclude a specific dependency from springBoots bootJar
gradle task (similar to the provided scope in maven).
I tried a custom configuration, but the dependency-which-should-not-be-in-bootJar
is still included in the resulting jar.
configurations{
provided
implementation.extendsFrom provided
}
dependencies {
// ...
provided "dependency-which-should-not-be-in-bootJar"
}
jar {
from configurations.compile - configurations.provided
from configurations.runtime
}
bootJar {
from configurations.compile - configurations.provided
from configurations.runtime
launchScript()
}
bootJar
includes the runtime classpath by default. It inherits fromimplementation
which you've configured to extend fromprovided
As a result, the runtime classpath includes your provided dependency so it's include in the fat jar. – Serratoprovided
toprovidedRuntime
and let it extend fromruntime
after that I tried to configure the bootJar to override the runtime include withfrom configurations.runtime - configurations.providedRuntime
which I thought should work but it doesn't. Can you point me to the right direction how to exclude a dependency properly from being packaged with the jar. – Woodshed