Using a custom Info.plist file

Some time you need full control on the contents of the Info.plist file (also called the Java Dictionary).

You can read more about how to use this file by reading Apples documentation

Let's say you save your custom Info.plist in src/main/app-resources/Info.plist

Then you should add the following to your POM:

 <project>
    ...
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>osxappbundle-maven-plugin</artifactId>
                <version>1.0-alpha-1</version>
                <configuration>
                    <mainClass>com.example.Main</mainClass>
                    <dictionaryFile>${basedir}/src/main/app-resources/Info.plist</dictionaryFile>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>bundle</goal>
                        </goals>
                    </execution>
               </executions>
           </plugin>
           ...
       </plugins>
   <build>
   ...
 </project>

Your custom dictionary may contain the following variables:

${bundleName}   (As defined in your POM. Default is the Maven name in your POM)
${mainClass}   (Your mainClass defined in the plugin configuration of your POM)
${iconFile}  (As defined in your POM. Defaults to a generic Application Icon)
${classpath}   (An <array> containing all you classpath entries, used as the value of the ClassPath key)

Info.plist example

This example shows how to set VM options and system properties using a custom Info.plist file.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
  <dict>
    <key>CFBundleName</key>
    <string>${bundleName}</string>
    <key>CFBundleVersion</key>
    <string>10.2</string>
    <key>CFBundleAllowMixedLocalizations</key>
    <string>true</string>
    <key>CFBundleExecutable</key>
    <string>JavaApplicationStub</string>
    <key>CFBundleDevelopmentRegion</key>
    <string>English</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleIconFile</key>
    <string>${iconFile}</string>
    <key>Java</key>
    <dict>
      <key>MainClass</key>
      <string>${mainClass}</string>
      <key>JVMVersion</key>
      <string>1.4+</string>
      <key>ClassPath</key>
      ${classpath}
      <key>VMOptions</key>
      <string>-Xmx512m -Xms128m</string>
      <key>Properties</key>
            <dict>
                <key>apple.laf.useScreenMenuBar</key>
                <string>true</string>
                <key>apple.awt.showGrowBox</key>
                <string>true</string>
            </dict>
    </dict>
  </dict>
</plist>

Reources:

  • Java System Properties Documents the OS X specific system properties you can use to tune your application's behaviour.