Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Gradle repository point to local directory

For some reason my offshore team is not able to Download the artifacts(Dependencies) from my clients Artifactory which is our Organizations dependency repository."Refresh Dependencies" triggers nothing and gives TIME OUT EXCEPTION. I see the that my "Gradle Dependencies" are downloaded to the location "D:/C813507/Gradle/gradle-1.11/bin/caches/modules-2/files-2.1/". Can i zip this folder and send over to them ? How do they implement something in gradle that points to their local directory. My build gradle has the following line. How to point the URL to local directory in Windows OS

repositories {          maven {             url 'http://artifactory.myorg.com:8081/artifactory/plugins-release'         }  } 
like image 381
Vinodh Thiagarajan Avatar asked Sep 22 '14 02:09

Vinodh Thiagarajan


People also ask

Where is my local Gradle repository?

Gradle's local repository folder is: $USER_HOME/. gradle/caches/modules-2/files-2.1.

What is local repo in Gradle?

The location for storing modules is called a repository. By specifying the repositories for a project, Gradle can find and retrieve modules. Repositories can be in different forms, such as a local directory or a remote repository.


2 Answers

If you can't give access to your offshore team, you can copy all dependencies jar that needed to a single directory, and then use flatDir repository.

repositories {    flatDir {        dirs 'D:/path/to/local/directory'    } }   dependencies {    compile name: 'name-of-jar' } 

Another way without using flatDir repository is:

dependencies {     compile files('/path/to/dir/something_local.jar') } 
like image 135
dieend Avatar answered Sep 29 '22 19:09

dieend


Instead of configuring flatDir repository, you can declare a local maven repository as following:

repositories {    maven {        url 'file://D:/path/to/local/directory'    } } 

As @Peter Niederwieser mentioned, flatDir repository doesn't support transitive dependency resolution. maven local repository does.

like image 34
Alex Lipov Avatar answered Sep 29 '22 20:09

Alex Lipov