Return to site

JPMS: Module declaration

· java

Modularity is a general concept. In software, it applies to writing and implementing a program or computing system as a number of unique modules, rather than as a single, monolithic design. A standardized interface is then used to enable the modules to communicate.

A module must provide a module descriptor—metadata that specifies the module's dependencies, the packages the module makes available to other modules, and more.
A module descriptor is the compiled version of a module declaration that's defined in a file named module-info. java .
Let's see the syntax of this module declaration:
The name of the file must be exactly
Modules are named via the module keyword.

located in com.mycompany.mypackage directory.

There's no sub-modules within modules.

com.mycompany.mypackage.api module could not be placed under com.mycompany.mypackage.