Use local folder inside build.gradle for resolving dependcies

(Ravi) #1

we have very restrictive access to outside network form our company . My onshore has build his gradle project and has shared files-2.1 folder and I have copied in D drive below location
D:\test\modules-2\files-2.1.

I want to use that in build.gradle file like below but its not working .Please help

repositories {
maven {
url ‘file://D:/test/modules-2/files-2.1’

    }
	
    }
0 Likes

(uklance) #2

I don’t think you can copy a cache from one machine and use it on another like this.

You might be interested in gradle dependency export plugin where you can

  1. Apply the plugin
  2. Export the dependencies to a folder using maven directory layout conventions
  3. Copy to another machine
  4. Use the folder as a maven repository on the second machine
1 Like

(Ravi) #3

Thanks for your suggestion …Do you have any sample code showing how to build maven repositories using plugin

0 Likes

(uklance) #4
plugins {
  id "java" 
  id "com.lazan.dependency-export" version "0.5"
}
dependencies {
   compile 'foo:bar:1.0'
}
mavenDependencyExport {
  exportDir = file("$buildDir/dependencyExport") 
  exportSources = true
  exportJavadoc = true 
}

command line
gradle mavenDependencyExport

1 Like

(Ravi) #5

It worked perfectly …thsnks

1 Like

(Ravi) #6

I tried compiling code by using dependencyExport folder as mavenLocal() . But unfortunately it’s not able to apply plugins which are mentioned in build.grade but all Jars it is able to resolve dependency using same exported folder .I checked all plugins are present in exported folder

0 Likes