https://kotlinlang.org logo
Title
m

MSC

05/18/2020, 9:14 PM
What’s the best practice for creating a library with all the dependencies necessary for implementation in the consumer project? e.g.: I’m generating gPRC service classes via
protobuf
plugin and packaging into a jar, then in the consumer project I want to add this library(jar file) as a dependency in the gradle file and be ready to create a blocking stub, which requires the
io.grpc
library to be present? 🤔
o

octylFractal

05/18/2020, 9:14 PM
is there something wrong with just depending on it?
do you need to bundle/shade/shadow the dependencies?
m

MSC

05/18/2020, 9:16 PM
I’d be uploading this jar to a repo, so if I bundle these dependencies together with the compiled classes, the file could get bigger(~13MB)
Should I just require that any consumer project must add those dependencies to their gradles in order to user the grpc services?!
o

octylFractal

05/18/2020, 9:18 PM
is there something wrong with using transitive dependencies?
c

Casey Brooks

05/18/2020, 9:21 PM
Just publish it as a maven dependency, the build tools (Gradle, Maven) will ensure the correct transitive dependencies are downloaded alongside your library. https://docs.gradle.org/current/userguide/publishing_maven.html. Gradle is smart enough to bundle the generated classes with the library (may need some additional Gradle configuration, depending on how those classes are being generated)
m

MSC

05/18/2020, 9:25 PM
Oh nice! I’ll check it out! Thanks @Casey Brooks and @octylFractal