You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An example application for my book [_The Java Module System_](https://www.manning.com/books/the-java-module-system?a_aid=nipa&a_bid=869915cb).
3
+
The example application from my book [_The Java Module System_](https://www.manning.com/books/the-java-module-system?a_aid=nipa&a_bid=869915cb).
4
4
The _Service Monitor_ is an application that observes a hypothetical network of microservices by
5
5
6
-
* contacting individual services
6
+
* contacting individual services (not really, it just makes up data)
7
7
* collecting and aggregating diagnostic data into statistics
8
8
* persisting statistics
9
9
* making statistics available via REST
@@ -12,29 +12,59 @@ It is split into a number of modules that focus on specific concerns.
12
12
Each module has its own directory that contains the known folder structure, e.g. `src/main/java`.
13
13
14
14
15
+
## Book References and Module Names
16
+
17
+
The project is closely related to the book.
18
+
The bookmark emoji 🔖 marks references to chapters and sections (for example, [🔖2] for chapter 2 and [🔖2.2] for section 2.2).
19
+
20
+
The module names in this demo are dangerously short to make them easier on the eyes in scripts, snippets, diagrams, and so forth.
21
+
**Do not use such short names in real life!**
22
+
Instead, name modules like packages, i.e. pick a domain that belongs to the project and reverse it, so you end up with unique names [🔖3.1.3].
23
+
24
+
15
25
## Branches
16
26
17
-
The master branch uses basic features, except where it has to use automatic and unnamed modules for the non-modularized dependencies (Spark, Hibernate).
27
+
The master branch uses basic features[🔖2.2], except where it has to use automatic and unnamed modules for the non-modularized dependencies (Spark, Hibernate).
18
28
Other branches explore individual features of the module system:
19
29
20
-
*[services](../../tree/feature-services) aka `provides ... with` and `uses`
* split package, on [compilation](../../tree/break-split-package-compilation) and [launch](../../tree/break-split-package-launch) (not properly documented)
* cyclic dependencies, on [compilation](../../tree/break-cyclic-dependency-compile-time) and [launch](../../tree/break-cyclic-dependency-run-time)[🔖3.2.2]
45
+
* split package, on [compilation](../../tree/break-split-package-compilation) and [launch](../../tree/break-split-package-launch)[🔖3.2.2]
46
+
*[package not exported](../..tree/break-package-not-exported-compile-time)[🔖3.3.3]
47
+
*[reflection over internals](../../tree/break-reflection-over-internals)[🔖3.3.3]
30
48
31
49
32
50
## Setup
33
51
34
-
This demo was developed against JDK 9+181 (first official version of [Java 9](http://www.oracle.com/technetwork/java/javase/downloads/jdk9-downloads-3848520.html)).
35
-
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 ([Linux, MacOS](https://stackoverflow.com/q/1951742/2525313), [Windows](https://www.howtogeek.com/howto/16226/complete-guide-to-symbolic-links-symlinks-on-windows-or-linux/)) them.
52
+
This demo was developed against JDK 9.0.4.
53
+
The command line scripts for shell and batch use the default commands `javac`, `jar`, and `java`.
54
+
If these commands don't refer to the Java 9 version on your system, you can enter the appropriate paths at the top of each script.
55
+
56
+
### Java
57
+
58
+
Don't worry if your system still runs Java 8 and you don't want to make Java 9 or later your default.
59
+
Just pick a recent Java version (see [the archives for JDK 9](http://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase9-3934878.html)) and unpack it.
60
+
Then you can add it to your IDE (how-to for [IntelliJ](https://www.jetbrains.com/help/idea/configuring-build-jdk.html) and [Eclipse](https://stackoverflow.com/q/13635563/2525313)) and [configure Maven with `.mavenrc](https://blog.codefx.org/tools/maven-on-java-9/#The-mavenrc-File) to use a specific JDK.
61
+
62
+
### IDEs and Build Tools
63
+
64
+
This is a multi-module Maven project, which your IDE should be able to import.
65
+
You should use at least Intellij IDEA 2017.2, Eclipse Oxygen.1a, or NetBeans 9.
66
+
If you're using Maven directly, make sure you have 3.5.0 or higher.
36
67
37
-
This is a multi-module Maven project, which your IDE should be able to import. If you're using Maven directly, make sure you have 3.5.0 or higher.
38
68
39
69
40
70
## Build and Execution
@@ -53,13 +83,14 @@ mvn exec:exec -pl .
53
83
Unfortunately, Jetty doesn't come up due to a `NoClassDefFoundError` (of `org.eclipse.jetty.http.pathmap.PathSpec`).
54
84
Need to inspect that...
55
85
56
-
### Scripts
86
+
It is also not possible to demonstrate all details with Maven.
87
+
Some branches only show the expected behavior when script is executed (the branch's README will point that out.)
57
88
58
-
The root directory contains a number of Linux shell scripts:
89
+
### Scripts
59
90
60
-
*`compile.sh`: compiles the modules one by one
61
-
*`multi-compile.sh`: compiles all modules at once
62
-
*`dry-run.sh`: launches the application with `--dry-run`, which aborts before calling the main method
63
-
*`run.sh`: launches the application
91
+
The root directory contains a number of Windows batch and Linux shell scripts:
64
92
65
-
Adapting them for Windows should be straight forwards except for where `$(find ...)` is used, which you might have to replace with a list of the actual files.
93
+
*`compile`: compiles the modules one by one
94
+
*`multi-compile`: compiles all modules at once
95
+
*`dry-run`: launches the application with `--dry-run`, which aborts before calling the main method
0 commit comments