You need to understand the basic processes like build tools and test tools. Selenium, TestNG, etc. are test tools. However Maven, Ant, Gradle, etc. are build tools.
The primary task of a build tool is to download all the dependencies, libraries, packages mentioned in the code, for running any software/application. The packages here will all be downloaded at runtime and the code will be executed simultaneously.
Note: It supports Selenium and TestNG for testing purpose only. It is not a test tool by itself.
An example of how Selenium JARS can be built for packaging is this Maven code below: