in src/main/java/org/apache/maven/plugins/jmod/JModCreateMojo.java [476:557]
private Commandline createJModCreateCommandLine(File resultingJModFile) {
Commandline command = new Commandline();
command.createArg().setValue("create");
if (moduleVersion != null) {
command.createArg().setValue("--module-version=" + moduleVersion);
}
List<String> classPaths;
if (classpathElements != null) {
classPaths = new ArrayList<>(classpathElements);
} else {
classPaths = new ArrayList<>(1);
}
if (targetClassesDirectory.exists()) {
classPaths.add(targetClassesDirectory.getAbsolutePath());
}
command.createArg()
.setValue("--class-path=" + getPlatformSeparatedList(classPaths).replace("\\", "\\\\"));
if (excludes != null && !excludes.isEmpty()) {
String commaSeparatedList = getCommaSeparatedList(excludes);
command.createArg().setValue("--exclude=" + commaSeparatedList.replace("\\", "\\\\"));
}
List<String> configList = handleConfigurationListWithDefault(configs, DEFAULT_CONFIG_DIRECTORY);
if (!configList.isEmpty()) {
command.createArg().setValue("--config=" + getPlatformSeparatedList(configList));
}
if (StringUtils.isNotBlank(mainClass)) {
command.createArg().setValue("--main-class=" + mainClass);
}
List<String> cmdsList = handleConfigurationListWithDefault(cmds, DEFAULT_CMD_DIRECTORY);
if (!cmdsList.isEmpty()) {
command.createArg().setValue("--cmds=" + getPlatformSeparatedList(cmdsList));
}
List<String> libsList = handleConfigurationListWithDefault(libs, DEFAULT_LIB_DIRECTORY);
if (!libsList.isEmpty()) {
command.createArg().setValue("--libs=" + getPlatformSeparatedList(libsList));
}
List<String> headerFilesList = handleConfigurationListWithDefault(headerFiles, DEFAULT_HEADER_FILES_DIRECTORY);
if (!headerFilesList.isEmpty()) {
command.createArg().setValue("--header-files=" + getPlatformSeparatedList(headerFilesList));
}
List<String> legalNoticesList =
handleConfigurationListWithDefault(legalNotices, DEFAULT_LEGAL_NOTICES_DIRECTORY);
if (!legalNoticesList.isEmpty()) {
command.createArg().setValue("--legal-notices=" + getPlatformSeparatedList(legalNoticesList));
}
List<String> manPagesList = handleConfigurationListWithDefault(manPages, DEFAULT_MAN_PAGES_DIRECTORY);
if (!manPagesList.isEmpty()) {
command.createArg().setValue("--man-pages=" + getPlatformSeparatedList(manPagesList));
}
List<String> modulePaths = new ArrayList<>(modulepathElements);
modulePaths.add(new File(javaHome, JMODS).getAbsolutePath());
command.createArg()
.setValue(
"--module-path=" + getPlatformSeparatedList(modulePaths).replace("\\", "\\\\"));
if (targetPlatform != null) {
command.createArg().setValue("--target-platform=" + targetPlatform);
}
if (warnIfResolved != null) {
command.createArg().setValue("--warn-if-resolved=" + warnIfResolved);
}
if (doNotResolveByDefault) {
command.createArg().setValue("--do-not-resolve-by-default");
}
command.createArg().setValue(resultingJModFile.getAbsolutePath());
return command;
}