Not fully understanding how caching works

I have compiled and published to github packages, my own java library, and a fork of another library (libGDX).

I push them both to my own private github packages repo, using code similar to this guide.

When I then use them in my Java app (I build from command line), everything works fine. However, every time I build it seems to be checking online again, and this takes a while to finish (maybe 40-50s).

I have tried to use --offline, but I get an error that

No cached version of [my package] available for offline mode.

However, when I look in my local gradle caches, in


I see the .jar downloaded (also the .pom and .module).

Am I misunderstanding how --offline and caching works? I assume that once I have the jar stored locally I should be able to work offline.

The only thing I can think, is that I’ve been trying to read and understand this page - Declaring dependencies - and maybe when I publish them to github, I am not declaring the dependency type properly?