Just as a heads up; Jigsaw (as it is today) doesn't have versions, so the issues you describe won't happen. There will be one global json-lib module that will be available to all modules.
They've taken enough to get to this point that adding version numbering isn't going to happen, but it doesn't rule it out adding it in the future. They did the minimum necessary to split out the Java libraries into different modules but no more.
If you want to have versioned dependencies, you have to work with a module system that understands versions, like OSGi.
Yeah, Jigsaw will provide the base primitives which will allow what I described to happen. But it's up to the Java ecosystem to create or update the dependency layer above it. I'm assuming Maven will, but if they don't this is an opportunity for another dependency system to replace it. I think fixing the version conflict issue is enough of a killer feature to overcome even something as entrenched as Maven. I'm hoping Maven keeps up with these changes because I really don't want to rebuild existing build systems.
Not sure about Maven, but Gradle has already introduced a "software model" feature which is meant to map almost directly to Jigsaw modules. So the idea is you'll configure the module system through the build system, and it'll generate the right Jigsaw data for you. It also handles versioning and other things Jigsaw doesn't do directly.
But will Gradle's "software model" be compatible with Java 9's? Gradle's already incompatible in that it uses Apache Groovy instead of Java 8 for build config files.
actually you still could run two json-lib modules, you create module1 which depends on json-lib1 but doesn't reexport it and module2 depends on json-lib2 but doesn't reexport it.
done.
Not really; a module system that has versions allows you to define dependencies in terms of version ranges, so that if installing a newer version into your app the module can decide in its dependencies if the version is compatible or not. If you are spinning up different names for each module/version then you have to go round updating all your code that depends on the module to use the different name, and you can't select a different one. The point was that Jigsaw doesn't have a concept of version numbers in its module dependency system; they are all dependent upon exact name only.
They've taken enough to get to this point that adding version numbering isn't going to happen, but it doesn't rule it out adding it in the future. They did the minimum necessary to split out the Java libraries into different modules but no more.
If you want to have versioned dependencies, you have to work with a module system that understands versions, like OSGi.