PSA: maven central and sonatype are slow
Published:
Most of the public maven repositories for downloading java artifacts (notably maven-central, and sonatype) are slow. Besides, build tools do not have a perfect track record of resolving dependencies from these repositories in an efficient manner.
A consequence of that is that if you are not sitting on a T1 or better connection and building from pure repos (sonatype, maven-central), rather than using a proxy, you are wasting your time waiting for the network on each build. This takes 15 mins to fix, forever:
docker pull sonatype/nexus
docker run -d -p 8081:8081 --name nexus -v /mnt/nexus-data:/nexus-data --restart unless-stopped sonatype/nexus3
- go to http://localhost:8081, login, configure two proxies for maven-central and sonatype, expose them through a group called public.
- in your local
.m2/settings.xml
, add:
<mirrors>
<mirror>`
<id>local-public</id>`
<mirrorof>external:*</mirrorof>
<name>Local Mirror.</name>
<url>http://localhost:8081/repository/public/</url>
</mirror>
</mirrors>