Showing posts with label java 14. Show all posts
Showing posts with label java 14. Show all posts

Wednesday, July 29, 2020

Multi-Module Project using Maven

A Spring Boot project that contains nested maven projects is called the multi-module project.

In the multi-module project, the parent project works as a container for base maven configurations.A multi-module project is defined by a parent POM referencing one or more submodules.

The parent maven project must contain the packaging type pom that makes the project as an aggregator. 

The pom.xml file of the parent project consists the list of all modules, common dependencies, and properties that are inherited by the child projects. The parent pom is located in the project's root directory. The child modules are actual Spring Boot projects that inherit the maven properties from the parent project.

Benefits of Using Multi-Modules:
The significant advantage of using this approach is that we may reduce duplication.
Let's say we have an application which consists of several modules, let it be a front-end module and a back-end module.
 
Now, we work on both of them and change functionality which affects the two. In that case, without a specialized build tool, we'll have to build both components separately or write a script which would compile the code, run tests and show the results.

Then, after we get even more modules in the project, it will become harder to manage and maintain.
Besides, in the real world, projects may need certain Maven plugins to perform various operations during build lifecycle, share dependencies and profiles or include other BOM projects.

Therefore, when leveraging multi-modules, we can build our application's modules in a single command and if the order matters, Maven will figure this out for us. Also, we can share a vast amount of configuration with other modules.

Parent POM:
Maven supports inheritance in a way that each pom.xml file has the implicit parent POM, it's called Super POM and can be located in the Maven binaries.
These two files are merged by Maven and form the Effective POM.


Thursday, June 18, 2020

Java14 Features

A significant number of Java Enhancement Proposals (JEPs) have been released in version 14. (Even more JEPs than Java 12 and 13 combined).

JDK 14 reached General Availability on 17 March 2020.

JAVA 14 addresses a total of 16 main enhancements/changes (JEPs) ranging from the Java language support to the latest APIs for ongoing JDK flight recorder monitoring. 

The entire feature list consists of:
  • Pattern Matching for instanceof (Preview)
  • Non-Volatile Mapped Byte Buffers (Incubator)
  • Helpful NullPointerExceptions
  • Switch Expressions (Standard)
  • Packaging Tool (Incubator)
  • NUMA-Aware Memory Allocation for G1
  • JFR Event Streaming
  • Records (Preview)
  • Deprecate the Solaris and SPARC Ports
  • Remove the Concurrent Mark Sweep (CMS) Garbage Collector
  • ZGC on macOS (experimental)
  • ZGC on Windows (experimental)
  • Deprecate the ParallelScavenge + SerialOld GC Combination
  • Remove the Pack200 Tools and API
  • Text Blocks (Second Preview)
  • Foreign-Memory Access API (Incubator)

ES12 new Features