How to cleanup .gradle cache folder?

I have following repository folders:

.gradle - 2.72 GB
.ivy2 - 794 MB
.m2 - 778 MB

Look .gradle very big, because I’m using gradle for android and server side projects, but I don’t know how to optimise, no command for cleaning old versions of libraries what i’m using. For example:

appcompat-v7-27.0.2.aar
appcompat-v7-27.0.1.aar
appcompat-v7-27.0.0.aar

appcompat-v7-26.0.1.aar

why? I don’t need old versions. I need just latest versions of libraries.
Have nice command in Homebrew :

brew cleanup - will remove all old versions of repository
brew cleanup node - will remove old versions of node js.

this is very useful command. Need add such as command to gradle too. For controling repository size.
I’m using SSD in my macbook pro, large storage very expensive for me.