in nbm-maven-plugin/src/main/java/org/apache/netbeans/nbm/BuildMacMojo.java [165:205]
void copyInfoPlist(File contentsDir) throws IOException, MojoExecutionException {
Path infoplist = contentsDir.toPath().resolve("Info.plist");
if (macAppTitle == null) {
macAppTitle = brandingToken;
}
if (macInfoplistFile != null) {
try (Stream<String> lines = Files.lines(macInfoplistFile.toPath())) {
String infoPListString = lines.map(s -> s.replace("${app.title}", macAppTitle))
.map(s -> s.replace("${app.name}", brandingToken))
.map(s -> s.replace("${app.version}", project.getVersion()))
.collect(Collectors.joining("\n"));
Files.write(infoplist, infoPListString.getBytes());
}
} else {
URL harnessResource = getClass().getClassLoader().getResource("harness");
JarURLConnection jarConnection = (JarURLConnection) harnessResource.openConnection();
JarFile jarFile = jarConnection.getJarFile();
JarEntry entry = jarFile.getJarEntry("harness/etc/Info.plist");
if (entry == null) {
throw new MojoExecutionException("macOS Info.plist not found in harness"
+ " or via macInfoplistFile parameter");
}
try (BufferedReader reader
= new BufferedReader(new InputStreamReader(jarFile.getInputStream(entry)))) {
String infoPListString = reader.lines()
.map(s -> s.replace("${app.title}", macAppTitle))
.map(s -> s.replace("${app.name}", brandingToken))
.map(s -> s.replace("${app.version}", project.getVersion()))
.collect(Collectors.joining("\n"));
Files.write(infoplist, infoPListString.getBytes());
}
}
}