Put jar file to cache manually

Hi,I’m using gradle 4.4,
and in my project gradle can’t find jar file remotly
how I put this jar file gradle cache manually

Instead of hacking the cache I suggest you try a flat directory repository approach

repositories {
    flatDir {
        dirs 'lib'

or reference the jar directly

dependencies {
    compile files('lib/local.jar')

Both ways, if you want your build to be working on other machines you have to make the jar available on them by some way (e.g. by adding it to your code repository).

I personally dislike both of these suggestions (flatdir or FileCollection) and instead prefer a local repository using the maven style directory layout.


repositories {
   maven {
      url file('/path/to/local/maven/repo') 

Using a maven style layout you can still support:

  • proper dependency resolution
  • transitive dependencies by including a pom
  • source & javadoc artifacts (useful in your IDE)
  • seamless switch to a remote repository in future

See this related post

1 Like