All Projects → nipafx → demo-jigsaw-advent-calendar

nipafx / demo-jigsaw-advent-calendar

Licence: CC0-1.0 License
An Advent Calendar Demonstrating Jigsaw EA

Labels

Projects that are alternatives of or similar to demo-jigsaw-advent-calendar

tqrespec
TQRespec - The respec tool for Titan Quest game
Stars: ✭ 59 (+268.75%)
Mutual labels:  jpms
JavaCertification
This is a full resource guide for my attempt to get Java 11 Certified
Stars: ✭ 67 (+318.75%)
Mutual labels:  jpms
susel
Super charge the module aware service loader in Java 11
Stars: ✭ 21 (+31.25%)
Mutual labels:  jpms
badass-runtime-plugin
Create a custom runtime image of your non-modular application
Stars: ✭ 143 (+793.75%)
Mutual labels:  jpms

Jigsaw Advent Calendar 🎄

This demo project contains the code for a post for the Java Advent Calendar (which I published in on my blog as well). It showcases a couple of features of Project Jigsaw.

The code is released into the public domain via CC0 so it can be used without any limitations.

😴 This demo project is no longer maintained. It is superseeded by a simpler "Hello World" example and the more well-rounded ServiceMonitor application. 😴

The Advent Calendar

Even though I do my best to ignore the whole christmas kerfuffle, it seemed prudent to have the demo uphold "the spirit of the season". So it models an advent calendar:

  • There is a Calendar, which has 24 CalendarSheets.
  • Each sheet knows its day of the month and contains a Surprise.
  • The death march towards Christmas is symbolized by printing the sheets (and thus the surprises) to the console.

Of course the calendar needs to be created first. It can do that by itself but it needs the means to create surprises. To this end it requires a List<SurpriseFactory>.

Sections

The demo consists of several sections, each building on the previous ones. There is a branch for each section.

  • 0️⃣ Before Jigsaw: describes the application's organization before Jigsaw
  • 1️⃣ Creating A Module: moves the application into Jigsaw land by moving it into a single module
  • 2️⃣ Splitting Into Modules: explores more of Jigsaw's core features by splitting the application into several modules
  • 3️⃣ Services: introduces services and the ServiceLocator for loose coupling between modules
  • 4️⃣ Automatic Modules: shows how modules can depend on non-modularized JARs
  • 5️⃣ Optional Dependencies: demonstrates dependencies that are mandatory at compile time but are not required at run time

Setup

This demo (obviously) requires Java 9. For it to work the Java 9 variants of javac, jar, and java must be available on the command line via javac9, jar9, and java9, e.g. by symlinking them.

The root directory contains a compileAndRun.sh, which - surprise - compiles and runs the example.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].