Example example_version
Part of the full Java 9 Jigsaw modules example suite.
|
Authors
Originally written by Martin Lehmann, Kristine Schaal and RĂ¼diger Grammes (cf. original repository). Migrated for Java Modules support documentation of Apache MavenTM in the course of the Maven Support & Care program by Gerd Aschemann (and other team members) as forked repository. Please add discussions, requirements, bugfixes, etc. to the fork instead of the original. |
What is this example about?
This example is not really about Java Modules. Instead, it shows that usage of the new versioning scheme.
For more background information, refer to JEP 223.
Sample output
This is sample output of the main class (example shown with Temurin-11.0.27+6):
Runtime.version() says, we are using Java version 11.0.27, build version 6 System properties say, we are using Java version as follows: java.version = 11.0.27 java.runtime.version = 11.0.27+6 java.vm.version = 11.0.27+6 java.specification.version = 11 java.vm.specification.version = 11
|
The output will vary depending on your installed Java version. This example demonstrates the version string format introduced in JEP 223 (Java 9). |
Output
This example uses golden master testing to ensure output consistency.
The expected output is compared with actual output using verify.sh.
Expected Output
Runtime.version() says, we are using Java version 11.0.28, build version 6
System properties say, we are using Java version as follows:
java.version = 11.0.28
java.runtime.version = 11.0.28+6
java.vm.version = 11.0.28+6
java.specification.version = 11
java.vm.specification.version = 11
Actual Output
Runtime.version() says, we are using Java version 11.0.28, build version 6
System properties say, we are using Java version as follows:
java.version = 11.0.28
java.runtime.version = 11.0.28+6
java.vm.version = 11.0.28+6
java.specification.version = 11
java.vm.specification.version = 11
Maven 4 Output
Runtime.version() says, we are using Java version 11.0.28, build version 6
System properties say, we are using Java version as follows:
java.version = 11.0.28
java.runtime.version = 11.0.28+6
java.vm.version = 11.0.28+6
java.specification.version = 11
java.vm.specification.version = 11
Maven 4 Migration
This example was migrated to Maven 4 using the standard approach documented in the central Maven 4 Migration guide. The migration required no special configuration beyond the standard Module Source Hierarchy setup.