How Java 9 modules solve problems associated with transitive dependencies?


How Java 9 modules solve problems associated with transitive dependencies?
I read that java 9 modules helps solving the problems that appears when pulling several versions of the same dependency due to transitive dependencies. I cannot see why. If you bring several modules you can obtain also the same problem. I mean, if one of the modules brings in one hamcrest version and others bring other test tools introducing versions 2, 3, 4 or whatever of mockito, or junit. How the modules helps with this issue?
1 Answer
1
When searching a module path for a module of a particular name, the module system takes the first definition of a module of that name. Version strings, if present, are ignored; if an element of a module path contains definitions of multiple modules with the same name then resolution fails and the compiler, linker, or virtual machine will report an error and exit. It is the responsibility of build tools and container applications to configure module paths so as to avoid version conflicts; it is not a goal of the module system to address the version-selection problem.
http://openjdk.java.net/jeps/261
In short, you can name your modules to have version specific strings as part of their names, but that's roughly it.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.