in nbm-maven-plugin/src/main/java/org/apache/netbeans/nbm/BuildMacMojo.java [231:256]
void copyLauncher(File macOSDir) throws IOException, MojoExecutionException {
Path launcherPath = macOSDir.toPath().resolve(brandingToken);
if (macLauncherFile != null) {
FileUtils.copyFile(macLauncherFile, launcherPath.toFile());
} else {
URL harnessResource = getClass().getClassLoader().getResource("harness");
JarURLConnection jarConnection = (JarURLConnection) harnessResource.openConnection();
JarFile jarFile = jarConnection.getJarFile();
JarEntry entry = jarFile.getJarEntry("harness/launchers/app-macOS");
if (entry == null) {
throw new MojoExecutionException("macOS launcher not found in harness"
+ " or via macLauncherFile parameter");
}
try (InputStream entryInputStream = jarFile.getInputStream(entry)) {
Files.copy(entryInputStream, launcherPath, StandardCopyOption.REPLACE_EXISTING);
}
}
launcherPath.toFile().setExecutable(true);
}