Like Rafal said it's because fedora doesn't come with a lot of the java packages pre-installed. Also because yum/dnf is quite different in managing dependencies from most of the modern programming languages (java, python, javascript etc).
/rant
Modern programming languages allows much finer grain control of those dependencies (e.g. maven for java, pip for python, npm for javascript). You can pick and choose what you want at what version etc. With yum/dnf, if you need package A, and A needs B. Even though you don't require B, it still pulls it for you. To make it worse, a lot of the java library packages bundles multiple jars (the smallest library artifact java build tools uses). This means even if you just need one jar in your actual build, you have to install the whole rpm that comes with more than you need. RPM subpackaging will help but AFAIK a lot of the packagers don't care or won't bother doing that. Not to mention you have no/very little control of what version of the library you are getting from yum...
/rant
That's the challenge we face. Will switching to another language help? Depending on the project. I have seen other tool written in python or ruby asking you to use pip/gem instead of yum/dnf due to the very same reason. 0install or use a docker container will help to reduce downloading unnecessary packages and will guarantee to work (exact version of the libraries we build and tested).
Regards,
Patrick