Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle library dependency in sub-depending module

Tags:

gradle

Having hard time to describe this and I bet this is something very simple, but I just can't google sollution.

I am using many modules in my project. For simple argument let's say I have modules A and B.

B depends on A.

When I add dependency to external library (using implementation keyword) in module A to use some of it's code in the module, I cannot access library's code in project B. How can I achieve that? I would like A to be my "base" project with all dependencies in that place rather than having to repeat myself in other modules, that depend on it.

like image 617
K.H. Avatar asked Oct 28 '25 02:10

K.H.


1 Answers

The implementation configuration means the dependencies are internal (implementation specific) for the project and should not be exposed on the compilation classpath of other dependent projects. This helps encapsulate dependencies and speeds up the build as you don't need to recompile dependent projects if you only change internal dependencies.

If you want to expose them, you need to use the api configuration instead, along with the java-library plugin.

like image 60
Bjørn Vester Avatar answered Oct 31 '25 08:10

Bjørn Vester



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!