I would like to compute and record the hash of module matched by the given pattern that depend upon directly on a modular JAR file being updated. For this a use --hash-modules
and --module-path
options.
There are my tries:
jar --hash-modules com.me.util --module-path "dist\com.me.jar;dist\com.me.util.jar" --update --file dist/com.me.jar --main-class=com.me.A --verbose --module-version 0.1 -C build/modules/com.me module-info.class build/modules/com.me/com/me/A.class build/modules/com.me/com/me/B.class
jar --hash-modules "com.me.util;com.me.util" --module-path "dist\com.me.jar;dist\com.me.util.jar" --update --file dist/com.me.jar --main-class=com.me.A --verbose --module-version 0.1 -C build/modules/com.me module-info.class build/modules/com.me/com/me/A.class build/modules/com.me/com/me/B.class
When I try to do it I get the warning message: "no module is recorded in hash in com.me".
These commands will create the *.jar files (modules) without any errors, but they won't add any hash information. I would like to see this information and take advantage of this functionality (--hash-modules
and --module-path
options). Please, tell me how to do it!
The complete structure of the project folders can be found here.
My experiments and working examples of using the jar tool's options are here.
The following operations described in Java Platform, Standard Edition Tools Reference (jar).
Uddhav Gautam, thank you for the link to additional documentation.
After reading carefully the documentation (Packaging: Modular JAR files (JEP 261: Module System) and
--hash-modules=PATTERN
(Java Platform, Standard Edition Tools Reference)), I realized what parameters should be given to solve this task.Here's a working example:
To see the result of the options, use the following command:
The result should be like this: