Erasing repositories cache

Hi, Everyone.

I want to delete the cache in the repository.

If you connect a repository such as maven, gradle, yum, etc., and there is no package in that repo, it fails, and you cannot send a re-request command for the same type of package after that.

Therefore, I want to delete the request cache stored inside Nexus so that I can rebuild or reinstall it, but I don’t know how.

Please let me know if anyone knows how.

Thank you

Hi Youna,
When working with tools like Maven (and others) you have to remember they maintain their own local cache. In case of Maven you can use -U flag to force refresh all dependencies (see Maven Embedder – Maven CLI Options Reference).
Nexus Repository allows you to invalidate cache on each individual repository in your repository as described in Repository Management. You may also be interested in checking out ‘Negative Cache’ section from the same page in case you want to customise this behaviour.

1 Like

I would like to initialize the cache on the nexus side rather than the method of initializing the cache (such as mvn-U or ./gradlew) directly through the command line. As you said, even if I set the TTL of the “negative cache” part to zero, the cache was not cleared. Since the repo that maven and gradle look at is Nexus, is it not affected to erase the cache only on Nexus? We need to clear cache on nexus side because we need to clear cache of install command such as yum and pypi as well as maven and Gradle…

Caching, especially when multiple applications are involved, can be really complicated. Consider each of your client as a separate scenario (in reality I’d assume you have multiple scenarios defined per each client). One such scenario can be visualised as:
Maven → Maven’s cache → Nexus Repository → Nexus Repository’s cache → Upstream server → (potentially more)
Hopefully this helps to explain why you have to clear cache on both your Nexus Repository and your client. This applies to virtually all other clients as well.

2 Likes

Oh! I understand after seeing what you wrote. Thank you. :grinning: