Search code examples
javajava-9java-modulejava-platform-module-systemmodule-info

Does JPMS support module version?


I thought that JPMS doesn't support module version. However, when I do java --list-modules I have the following output:

java.activation@9
java.base@9
java.compiler@9
java.corba@9
java.datatransfer@9
java.desktop@9
java.instrument@9 
....

So, I can't understand what this @9 is. Is this version or what? If JPMS supports module version, can I set in module-info of module A, that module A requires module B of certain version?


Solution

  • I can't understand what this @9 is. Is this version or what?

    Yes, it is the version of the module.

    If JPMS supports module version, can I set in module-info of module A, that module A requires module B of certain version?

    No, you cannot refer a specific version of a module in another module's declaration. I believe this was always clearly mentioned in The State of the Module System#Module Declarations

    A module’s declaration does not include a version string, nor constraints upon the version strings of the modules upon which it depends. This is intentional as it is not a goal of the module system to solve the version-selection problem, which is best left to build tools and container applications.