On macOS, I am using Javapackager to make an Application.app bundle (called a disk image) from my Application.jar Java archive:
javapackager \
-deploy \
-native image \
-srcfiles Application.jar \
-outdir dist \
-outfile Application \
-appclass Application
The resulting Application.app bundle is a directory with the following layout:
Application.app
|--Contents
|--Info.plist
|--PkgInfo
|--Java
| |--Application.jar
|--MacOS
| |--Application
|--Resources
However I have some <language>.lproj directories (which hold InfoPlist.strings files for localizing some strings of the Info.plist file, cf. Apple's Developer website) on my file system that need to be copied in the Resources directory of the Application.app layout, like this:
Application.app
|--Contents
|--Info.plist
|--PkgInfo
|--Java
| |--Application.jar
|--MacOS
| |--Application
|--Resources
|--en.lproj
|--InfoPlist.strings
|--fr.lproj
|--InfoPlist.strings
How can I tell Javapackager to do that? (I do not want to copy the <language>.lproj directories myself in the Application.app bundle after its creation, as it would break its signature.)
As a workaround:
put your custom
Info.plistfile inpackage/macosx/(create if non existent) for javapackager to pick it up during execution, then run your javapackager as you normally would.manually copy the
*.lproj/InfoPlist.stringsstructure over to theApplication.app/Contents/Resourcesfolder.sign both files, replace with your values. Hint: You can find out your values from the javapackager console output. Something like:
codesign -s "Developer ID Application: Your Company Inc (A1234ABCDE)" --prefix com.domain. ./Application.app/Contents/Resources/en.lproj/InfoPlist.stringsdo the same for
fr.lprojTo verify it looks okay:
codesign --verify --strict --verbose=2 ./Application.app/Contents/Resources/en.lproj/InfoPlist.stringsShould output:
./Application.app/Contents/Resources/en.lproj/InfoPlist.strings: valid on disk./Application.app/Contents/Resources/en.lproj/InfoPlist.strings: satisfies its Designated Requirementdo the same for
fr.lprojThen replace existing signature with command below. This regenerates a new updated
CodeResourcesfile underContents/_CodeSignature/codesign -s "Developer ID Application: Your Company Inc (A1234ABCDE)" --prefix com.domain. --force --deep ./Application.appShould output:
./Application.app: replacing existing signatureAnd the updated CodeResources file should have entries for
en.lprojandfr.lprojlike:Verify that your app conforms to Gatekeeper policies when you distribute with Developer ID, to mimic what Gatekeeper does.
codesign --verify --deep --strict --verbose=2 ./Application.app