You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DMG creation fails with Maven build in Jenkins #474
When the Maven build is run in our Jenkins DMG creation fails. This results from the fact that an OSA script is run that uses Finder to arrange the size of the DMG image and the position of the icons. This leads to creating a .DS_Store file on the volume.
Unfortunately there is no way to arrange the icons in the DMG volume other than using the Finder. At the end this leads to the decision to
create no DMG image when running in headless mode (Jenkins build) or
create a simple DMG image that looks a little bit ugly.
We would like to allow the latter and I inspected the code of this plugin.
I made a small modification in GenerateDmg and put the code in charge to run the OSA script into an if clause
I did a test run with this invocation: mvn -Djava.awt.headless=true clean package
Maybe there are better options? It could be also possible to pass an argument like a headless flag to the OSA script and do not run the Finder commands when headless mode is encountered? Or maybe you have even better ideas?
Versions
Javapackager: 1.7.6
Java: 18.0.2.1
Maven: 3.8.1
Pull request
If you like I can create a pull request when we have discussed and found the best way to handle this situation. I am open for your proposals.
That seems like a reasonable behavior change, though I think it should probably have a config flag to enable it so that it still would fail in a headless environment when using it in a context where you do care about the presentation of the final DMG. A config flag that defaults to auto-detection but allows explicitly opting either in or out could also be a reasonable option here.
We could add these parameters in MacConfig to define this new behavior:
<macConfig>
<headlessMode>false|true</headlessMode> <!-- false by default -->
<preconfiguredDsStorePath>path/to/custom/.DS_Store</preconfiguredDsStorePath>
</macConfig>
The preconfiguredDsStorePath parameter points to a preconfigured .DS_Store. If it's specified, the file should be copied into the DMG before the signing process.
We might not need the headlessMode parameter (it’s redundant, since we already have GraphicsEnvironment.isHeadless()).
Activity
maths22 commentedon Sep 1, 2025
That seems like a reasonable behavior change, though I think it should probably have a config flag to enable it so that it still would fail in a headless environment when using it in a context where you do care about the presentation of the final DMG. A config flag that defaults to auto-detection but allows explicitly opting either in or out could also be a reasonable option here.
fvarrui commentedon Sep 2, 2025
We could add these parameters in
MacConfigto define this new behavior:The
preconfiguredDsStorePathparameter points to a preconfigured.DS_Store. If it's specified, the file should be copied into the DMG before the signing process.fvarrui commentedon Oct 4, 2026
Also reported in #377 (CircleCI), closed as a duplicate of this one. Same cause:
customize-dmg.applescriptdrives the Finder throughosascript, which isn't available or allowed on headless CI agents. A CircleCI workaround is enabling AppleScript support: https://support.circleci.com/hc/en-us/articles/360057033612-Enabling-AppleScript-Support-on-macOS