Skip to content

Commit b12b4d4

Browse files
author
Nicolai Parlog
committed
Update README
1 parent d39e6d9 commit b12b4d4

File tree

1 file changed

+51
-20
lines changed

1 file changed

+51
-20
lines changed

README.md

Lines changed: 51 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# ServiceMonitor
22

3-
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).
44
The _Service Monitor_ is an application that observes a hypothetical network of microservices by
55

6-
* contacting individual services
6+
* contacting individual services (not really, it just makes up data)
77
* collecting and aggregating diagnostic data into statistics
88
* persisting statistics
99
* making statistics available via REST
@@ -12,29 +12,59 @@ It is split into a number of modules that focus on specific concerns.
1212
Each module has its own directory that contains the known folder structure, e.g. `src/main/java`.
1313

1414

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+
1525
## Branches
1626

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).
1828
Other branches explore individual features of the module system:
1929

20-
* [services](../../tree/feature-services) aka `provides ... with` and `uses`
21-
* [implied readability](../../tree/feature-implied-readability) aka `requires transitive`
22-
* [optional dependencies](../../tree/feature-optional-dependencies) aka `requires static`
23-
* [qualified exports](../../tree/feature-qualified-exports) aka `exports to`
30+
* [resource encapsulation](../../tree/feature-resources) [🔖5.2]
31+
* [services](../../tree/feature-services) aka `provides ... with` and `uses` [🔖10]
32+
* [implied readability](../../tree/feature-implied-readability) aka `requires transitive` [🔖11.1]
33+
* [optional dependencies](../../tree/feature-optional-dependencies) aka `requires static` [🔖11.2]
34+
* [qualified exports](../../tree/feature-qualified-exports) aka `exports to` [🔖11.3]
35+
* [image creation with `jlink`](../../tree/feature-jlink) [🔖14]
36+
* [layers](../../tree/feature-layers) [🔖12.4]
37+
38+
The [branch `features-combined`](../../tree/features-combined) combines many of those into a final version of the application [🔖15.1].
2439

2540
Then there are some branches that explore how things can break:
2641

27-
* [duplicate modules](../../tree/break-duplicate-modules-even-if-unrequired) (not properly documented)
28-
* split package, on [compilation](../../tree/break-split-package-compilation) and [launch](../../tree/break-split-package-launch) (not properly documented)
29-
* [missing transitive dependency](../../tree/break-missing-transitive-dependency) (not properly documented)
42+
* [missing transitive dependency](../../tree/break-missing-transitive-dependency) [🔖3.2.2]
43+
* [duplicate modules](../../tree/break-duplicate-modules-even-if-unrequired) [🔖3.2.2]
44+
* 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]
3048

3149

3250
## Setup
3351

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.
3667

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.
3868

3969

4070
## Build and Execution
@@ -53,13 +83,14 @@ mvn exec:exec -pl .
5383
Unfortunately, Jetty doesn't come up due to a `NoClassDefFoundError` (of `org.eclipse.jetty.http.pathmap.PathSpec`).
5484
Need to inspect that...
5585

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.)
5788

58-
The root directory contains a number of Linux shell scripts:
89+
### Scripts
5990

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:
6492

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
96+
* `run`: launches the application

0 commit comments

Comments
 (0)