Mac で実行可能なバージョンの Java ランチャーを作成できるように、maven os x アプリケーション バンドル プラグインを使用しています。ユーザーにゲートキーパーの問題を与えないように、2 つの手順の一部としてこれを行う必要があります...
Java作業ディレクトリを適切に設定するためにカスタムplistを構成する必要があります(jarをクリックするとコードが正常に実行され、.appをクリックすると終了コード1でクラッシュします)
プラグインを使用すると、独自の plist を作成し、pom のどこにあるかを示すことができます。
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>osxappbundle-maven-plugin</artifactId>
<version>1.0-alpha-1</version>
<configuration>
<mainClass>com.helion3.Launcher</mainClass>
<dictionaryFile>${basedir}/src/main/resources/Info.plist</dictionaryFile>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>bundle</goal>
</goals>
</execution>
</executions>
</plugin>
ファイルはその場所に存在します。を実行するmvn package
と、失敗するようになりました。
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:osxappbundle-maven-plugin:1.0-alpha-1:bundle (default) on project liftoff: Could not find resource for template /Users/myacct/Documents/workspace/MyProgram/src/main/resources/Info.plist
を実行するvi /Users/myacct/Documents/workspace/MyProgram/src/main/resources/Info.plist
と、ファイルが正しく開きます。
最初に生成されたものをコピーし、単一の workingDirectory キーを追加し、いくつかの値をプラグインのプレースホルダーに置き換えたため、私の plist 自体は有効であるはずです。
<?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>${describe}</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>GenericJavaApp.icns</string>
<key>Java</key>
<dict>
<key>WorkingDirectory</key>
<string>$APP_PACKAGE/Contents/Resources</string>
<key>MainClass</key>
<string>${mainClass}</string>
<key>JVMVersion</key>
<string>1.4+</string>
<key>ClassPath</key>
${classpath}
</dict>
</dict>
</plist>