Gradle build with no internet and no cached

I’m using Gradle 5.6.4.
I also use plugins like spotbugs in my build.gradle.
I want to do the build in an environment where there is no internet and no Gradle cache.

I’ve defined flatDirs and dirs for repositories in the buildscript.
I put a jar file like “spotbugs-gradle-plugin-3.0.0.jar” in my dirs.
But when I ran BUILD in OFFLINE mode, I got the following error.

FAILURE: Build failed with an exception.
What went wrong
A problem occurred configuring root project ‘Project1’:
Could not resolve all artifacts for configuration ‘:classpath’.
Could not download spotbugs-gradle-plugin.jar (com.github.spotbugs:spotbugs-gradle-plugin:3.0.0): No cached version available for offline mode

Why does Gradle only see caches in offline mode, rather than flatDirs?
Please let me know how I can build.

same issue i’m facing too and not able to determine the fault yet

if you get the solution how to fix tell me too please.