'Manually install Gradle plugin

For reasons out of my control I'm unable to resolve plugins from the internet. I want to know how can I manually install the plugins I need so gradle finds them.

I found the .gradle folder and I assume they'll be downloaded there, but have no idea where I should put them.

Any help is more than welcomed.



Solution 1:[1]

As mentioned in How to make Gradle repository point to local directory, we can use

repositories {
   flatDir {
       dirs 'D:/path/to/local/directory'
   }
}

or

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

and put all *.jar and *.pom files into this directory.

If you write not absolute path, it will be resolved relatively folder with this gradle file.

Also there is a note: flatDir repository doesn't support transitive dependency resolution, while maven local repository does.

Solution 2:[2]

The gradle cache in .gradle is a bit finicky, and not really meant to be changed manually. See some additional information about making gradle cache portable here: https://stackoverflow.com/a/34973244/745574

Maybe the best way to cache plugins offline is to find a way to add the plugin binaries to you local .m2 folder - maven cache is more forgiving of copy pasting files.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Community