How to copy gradle dependencies from a subproject in a multi-project build?

179 Views Asked by At

I have a Java library built with gradle for which I would like to modify the repositories it reads from and publishes to, without changing it the original library files.

So, I created a new project library (lib-internal) which is just overriding the repositories and publishing options of the library that I don't want to modify (lib-open-source).
I could force lib-internal to use the source from lib-open-source, BUT I failed to copy its dependencies.

In my build.gradle of lib-internal, I have something like this copy the sources:

sourceSets.main.java.srcDirs = [project(':lib-open-source').projectDir.toString() + '/src/main/java']

But I am looking for something similar for its dependencies.
In short, I'm looking for the correct syntax of something like:

dependencies = project(':lib-open-source').getDependencies()

I also tried something with the configurations, as suggested by the help of the getDependencies() method but can't find the correct syntax.

configurations.add(project(':lib-open-source').configurations.compileClasspath)

If I copy the dependencies block of lib-open-source into lib-internal, it works as I want to, but I want to avoid this copy-paste.

Thank you!

0

There are 0 best solutions below