in src/main/org/apache/tools/ant/taskdefs/modules/Jmod.java [1206:1283]
private Collection<String> buildJmodArgs() {
Collection<String> args = new ArrayList<>();
args.add("create");
args.add("--class-path");
args.add(classpath.toString());
// Paths
if (modulePath != null && !modulePath.isEmpty()) {
args.add("--module-path");
args.add(modulePath.toString());
}
if (commandPath != null && !commandPath.isEmpty()) {
args.add("--cmds");
args.add(commandPath.toString());
}
if (configPath != null && !configPath.isEmpty()) {
args.add("--config");
args.add(configPath.toString());
}
if (headerPath != null && !headerPath.isEmpty()) {
args.add("--header-files");
args.add(headerPath.toString());
}
if (legalPath != null && !legalPath.isEmpty()) {
args.add("--legal-notices");
args.add(legalPath.toString());
}
if (nativeLibPath != null && !nativeLibPath.isEmpty()) {
args.add("--libs");
args.add(nativeLibPath.toString());
}
if (manPath != null && !manPath.isEmpty()) {
args.add("--man-pages");
args.add(manPath.toString());
}
// Strings
String versionStr =
(moduleVersion != null ? moduleVersion.toModuleVersionString() : version);
if (versionStr != null && !versionStr.isEmpty()) {
args.add("--module-version");
args.add(versionStr);
}
if (mainClass != null && !mainClass.isEmpty()) {
args.add("--main-class");
args.add(mainClass);
}
if (platform != null && !platform.isEmpty()) {
args.add("--target-platform");
args.add(platform);
}
if (hashModulesPattern != null && !hashModulesPattern.isEmpty()) {
args.add("--hash-modules");
args.add(hashModulesPattern);
}
// booleans
if (!resolveByDefault) {
args.add("--do-not-resolve-by-default");
}
for (ResolutionWarningSpec moduleWarning : moduleWarnings) {
moduleWarning.validate();
args.add("--warn-if-resolved");
args.add(moduleWarning.getReason().toCommandLineOption());
}
// Destination file
args.add(jmodFile.toString());
return args;
}