Deploy all gradle dependencies within project sources

(marx) #1

Hi All
I would like to ship a multiproject with all the required dependencies (jars and other libs) contained in the project itself.
Few Sub projects uses java and ‘’ plugins.

I’ve started defining a resolutionStrategy inside allproject->configuration.all like the following:

// Iterate over resolved dependency
        resolutionStrategy.eachDependency { DependencyResolveDetails details ->
            if( == 'org.jacoco'){
                //force a different version
resolutionStrategy {
            force 'junit:junit:4.10'
            forcedModules = ['junit:junit:4.10']

The above works correctly

I’ve used the following task to collect dependency information:

subprojects {
    task allDeps(type: DependencyReportTask) {}

credit to Marcin

Obtaining the following output:

testCompile - Classpath for compiling the test sources.
\--- junit:junit:4.12 -> 4.10
     \--- org.hamcrest:hamcrest-core:1.1

Now that i know how to overwrite the dependency version , my question is : where should I place all the jars/libs required and how to instruct gradle to use that location to look for deps?
My final aim is , once the projet repos has been cloned, to successfully build all the sub projects using the --offline option.