in nbm-maven-plugin/src/main/java/org/apache/netbeans/nbm/BuildMacMojo.java [112:170]
public void execute( )
throws MojoExecutionException, MojoFailureException
{
if ( !"nbm-application".equals( project.getPackaging( ) ) )
{
throw new MojoExecutionException(
"This goal only makes sense on project with 'nbm-application' packaging." );
}
try
{
File bundleDir = new File( outputDirectory, brandingToken + ".app" );
bundleDir.mkdirs( );
File contentsDir = new File( bundleDir, "Contents" );
contentsDir.mkdirs( );
File resourcesDir = new File( contentsDir, "Resources" );
resourcesDir.mkdirs( );
File appDir = new File( resourcesDir, brandingToken );
appDir.mkdirs( );
File macOSDir = new File( contentsDir, "MacOS" );
macOSDir.mkdirs( );
File app = new File( outputDirectory, brandingToken );
FileUtils.copyDirectoryStructure( app, appDir );
// delete windows executables
Files.delete( appDir.toPath( ).resolve( "bin/" + brandingToken + ".exe" ) );
Files.delete( appDir.toPath( ).resolve( "bin/" + brandingToken + "64.exe" ) );
copyIcon( resourcesDir );
copyInfoPlist( contentsDir );
copyLauncher( macOSDir );
if ( macZipBundle )
{
DefaultFileSet fileset = new DefaultFileSet( outputDirectory );
fileset.setIncludes( new String[] {bundleDir.getName( ), bundleDir.getName( ) + "/**"} );
ZipArchiver archiver = new ZipArchiver( );
archiver.addFileSet( fileset );
File zipFile = new File( outputDirectory, brandingToken + "-macOS.zip" );
archiver.setDestFile( zipFile );
archiver.createArchive( );
}
}
catch ( Exception ex )
{
throw new MojoExecutionException( "Build macOS application bundle failed: " + ex, ex );
}
}