Project Jigsaw vs Maven

前端 未结 2 690
北恋
北恋 2020-12-23 21:40

From Jigsaw Project:

Make it easier for developers to construct and maintain libraries and large applications, for both the Java SE and EE Platforms

相关标签:
2条回答
  • 2020-12-23 21:57

    Very simplified answer

    After Jigsaw, public will be public only within the JAR scope. To see the class outside the JAR it must be exported.

    Java will force modularization because any inter module interaction will have to be specified in the module-info file.

    For example, if you produce a WAR it will remain almost unchanged but all JARs packages in the WAR must define a module-info (or not define it and be treated as automatic or unnamed modules).

    Maven has 2 main features: dependency management and building:

    • Dependency management means Maven can determine versions of libraries and download them from repositiories.
    • Building means Maven can compile code and package it into artifacts.

    To conclude: Maven will still be responsible for building, but one must learn how to compile and package using Jigsaw modules.

    0 讨论(0)
  • 2020-12-23 22:14

    Modules are not in any way a threat to build tools. Modules complement build tools because build tools construct a dependency graph of artifacts and their versions at build time while modules enforce dependencies of artifacts/modules (not including versions) at build time and run time.

    From the State of the Module System:

    "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: 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."
    
    0 讨论(0)
提交回复
热议问题