The better way
One thing which amazes me so much about the JavaScript and Java ecosystems ('swamps'?) is that their idea of 'dependency management' involves pulling libraries and snippets from all across the internet. Whether it's NPM or Maven (Nexus), the issue remains the same. Good luck compiling that 1-year old project because some crucial dependencies no longer match or have gone AWOL.
Or hey, maybe you fancy compiling/building a project somewhere where pulling down half a GB of dependencies won't go over so well?
In the very comfortable world of C/C++ development, libraries usually take the form of a few MB (or kB) of source and a DLL/SO file if it's particularly big. You get them from one's package manager (Aptitude, Pacman, etc.) which is a repository curated by the same people responsible for your OS (or close enough, like with MSYS2).
Of course, the Java ecosystem seems to be currently moving to a dependency-less environment, minus one: the entire Spring universe. As soon as Java on Android is dead, they can probably just drop the 'Java' name and go with just 'Spring' :)