Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Project Jigsaw vs Maven

From Jigsaw Project:

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

I'm trying to learn what project Jigsaw is and till now it seems that the goal of Project Jigsaw somewhat overlaps with what we did using Maven (or Gradle) dependency management:

  • Is it a threat to build tools like Maven?
  • Or my understanding is wrong and project Jigsaw is going to complement these build tools in some way?
like image 292
justAbit Avatar asked Oct 04 '16 05:10

justAbit


People also ask

What is Maven Dependencymanagement?

What Is Maven Dependency Management? Dependency management in Maven allows teams to manage dependencies for multi-module projects and applications. These can consist of hundreds or even thousands of modules. Using Maven can help teams define, create, and maintain reproducible builds.

What is a Maven bom?

What Is Maven BOM? BOM stands for Bill Of Materials. A BOM is a special kind of POM that is used to control the versions of a project's dependencies and provide a central place to define and update those versions.

What is multi-module project in Maven?

A multi-module project is built from an aggregator POM that manages a group of submodules. In most cases, the aggregator is located in the project's root directory and must have packaging of type pom. The submodules are regular Maven projects, and they can be built separately or through the aggregator POM.

What is reactor in Maven?

The mechanism in Maven that handles multi-module projects is referred to as the reactor. This part of the Maven core does the following: Collects all the available modules to build. Sorts the projects into the correct build order. Builds the selected projects in order.


2 Answers

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.

like image 133
michaldo Avatar answered Sep 17 '22 15:09

michaldo


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." 
like image 22
Jason Avatar answered Sep 20 '22 15:09

Jason