Skip to content

Commit 876d515

Browse files
committed
#67 Updating docs; style; adding Luke to copyright.txt; fixing test
1 parent 7b633f5 commit 876d515

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

README.md

+11-4
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ the _add-module-info_ goal as follows:
187187
<goal>add-module-info</goal>
188188
</goals>
189189
<configuration>
190-
<jvmVersion>9</jvmVersion>
190+
<jvmVersion>11</jvmVersion>
191191
<module>
192192
<moduleInfo>
193193
<name>com.example</name>
@@ -204,8 +204,15 @@ the _add-module-info_ goal as follows:
204204
...
205205
```
206206

207-
The optional `jvmVersion` element allows to define for which JVM version the module descriptor should be created.
208-
When defined, the module descriptor will be put into `META-INF/versions/${jvmVersion}`, otherwise it will be put into the root of the final JAR.
207+
The optional `jvmVersion` element allows to define which JVM version the module descriptor should target
208+
(leveraging the concept of multi-release JARs).
209+
When defined, the module descriptor will be put into `META-INF/versions/${jvmVersion}`.
210+
The value must be `9` or greater.
211+
The special value `NONE` can be used to add the descriptor to the root of the final JAR.
212+
By default, `9` is used, i.e. module descriptors will go into `META-INF/versions/9`.
213+
This is to ensure a maximum of compatibility with older libraries scanning class files that may fail when encountering the `module-info.class` file
214+
(and chances are much lower that such tool will look for class files under `META-INF/versions/...`).
215+
For tools aware of the module system the effect of having the module descriptor in the JAR root and under `META-INF/versions/9` should be the same.
209216

210217
The following configuration options exist for the `<module>` configuration element:
211218

@@ -352,7 +359,7 @@ current build will be used). Must unambiguously identify one toolchain entry of
352359
that matches all given requirements in its `<provides>` configuration. This can be used for
353360
creating runtime images on one platform (e.g. OS X) while targeting another (e.g. Linux).
354361
* `ignoreSigningInformation`: Suppresses a fatal error when signed modular JARs are linked
355-
in the runtime image. The signature-related files of the signed modular JARs aren’t copied
362+
in the runtime image. The signature-related files of the signed modular JARs aren’t copied
356363
to the runtime image.
357364

358365
Once the image has been created, it can be executed by running:

copyright.txt

+1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ Antoine Sabot-Durand
55
Gunnar Morling
66
Guillermo González de Agüero
77
J. Pablo Fernández
8+
Luke Hutchison
89
Ricardo Malikoski
910
Sander Mak

core/src/main/java/org/moditect/commands/AddModuleInfo.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,18 @@ public AddModuleInfo(String moduleInfoSource, String mainClass, String version,
5656
if (jvmVersion == null) {
5757
// By default, put module descriptor in "META-INF/versions/9" for maximum backwards compatibility
5858
this.jvmVersion = Integer.valueOf(9);
59-
} else if (jvmVersion.equals("NONE")) {
59+
}
60+
else if (jvmVersion.equals("NONE")) {
6061
this.jvmVersion = null;
61-
} else {
62+
}
63+
else {
6264
try {
6365
this.jvmVersion = Integer.valueOf(jvmVersion);
6466
if (this.jvmVersion < 9) {
6567
throw new NumberFormatException();
6668
}
67-
} catch (NumberFormatException e) {
69+
}
70+
catch (NumberFormatException e) {
6871
throw new IllegalArgumentException("Invalid JVM Version: " + jvmVersion);
6972
}
7073
}

core/src/test/java/org/moditect/test/AddModuleInfoTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public void addJvmVersionModuleInfoAndRunModular() throws Exception {
9898
"1.42.3",
9999
Paths.get( "target", "generated-test-resources", "example.jar" ),
100100
Paths.get( "target", "generated-test-modules" ),
101-
9,
101+
"9",
102102
false
103103
)
104104
.run();

0 commit comments

Comments
 (0)