Maven Module vs Java 9 Module

15

In addition to the fact that Maven works with jars and Java 9 with "modules", what is the difference between the modularization system of the two?

Why would I fail to modularize my systems with Maven to modularize with Java 9?

    
asked by anonymous 04.08.2017 / 16:20

3 answers

4

In a very simple way, the difference is:

  • Maven manages dependencies compile-time . Maven makes it easy to build software. Not just when compiling, but also when testing, packaging and distributing the software.

  • Java Platform Module manages run-time dependencies . Only used at run time in the JVM (Java virtual machine).

Interesting that even the documentation of class Module underscores this. link

  

Represents a run-time module, either named or unnamed.

In short, each system acts at different times. Be sure to use Maven.

BONUS QUESTION: Why would I stop modulating my systems with OSGi to modularize with Java 9?

ANSWER: Continue using OSGi, Java 9 does not understand module versioning.

    
23.09.2017 / 02:54
2

Maven

Modules are separate code libraries that are added to the project as a dependency. As a final result, we have a project consisting of several modules that run on top of the traditional Java runtime (JVM).

Java 9

The modules consist of smaller portions of the runtime, specific to the project's needs. This new feature will enable a great performance improvement to applications, especially those running on devices with low processing power

    
05.08.2017 / 06:08
-2

This post brings an important consideration to your question, and , in my view, also responds:

  

"Maven modules are a way to organize your project into several   subprojects (modules). With Maven, you can control the versions of   these modules and the dependencies between these modules. Each module   will produce an artifact. Java modules are a way to strongly   encapsulate your classes. It does not provide any means to control the   version of an artifact you are using. So, Maven modules and Java   modules serves a different purpose. The confusing part is that the same   term is used when they represent something different. But as   long as we know the difference, this should not be a problem "

Modules in Maven are a means of organizing your project into subprojects (modules) .You can control the versions of these subprojects as well as the dependencies between them.Any subprojects will produce an artifact.Java modules are a means of tightly encapsulating your classes, they do not provide any means to control the versions of the artifacts that your application uses, then , Maven modules and Java for different purposes.

What may confuse the same term (module) is used to represent different things, but knowing how to distinguish this should not be a problem.

    
19.12.2018 / 16:21