perdian / macosappbundler-maven-plugin Goto Github PK
View Code? Open in Web Editor NEWMaven plugin for creating a native macOS bundle containing all dependencies required by a Maven project
License: Apache License 2.0
Maven plugin for creating a native macOS bundle containing all dependencies required by a Maven project
License: Apache License 2.0
This might not be the right place, but some people complain that my MacOS bundled apps have a menu in English: About, Services, Hide, Hide others, Show all, Quit. I don't know if this is related to packaging or something else, but I thought this would be the right place to ask people who might know.
Any idea?
I found a very interesting edge case that I think it would probably be easy to fix.
It looks like when the JDK is included, this file Contents/Java/jdk/lib/jspawnhelper is not executable, as it is before it is copied into the bundle).
The result of this is that all attempts to use ProcessBuilder generate a Not Found error.
It took me forever to figure out what was going on here, finally I found this https://macosx-port-dev.openjdk.java.narkive.com/8NdCdcOt/spawning-a-process-from-an-app-packaged-with-appbundler-impossible
When explicitely selecting a JDK via the JVMRuntimePath
option I had the feeling in the past then the dylib
was chosen correctly from the path specified but the classpath was still used by the default JDK located in the system JAVA_HOME
location.
TODO: Verify if that's really the case and set JAVA_HOME
from within the native launcher if needed.
Hi,
I might have overlooked a thing but it seems like the plugin doesn't generate the *.dmg
file although it logged that it would.
pom.xml
file used in the build linked aboveAs I said I might as well just be stupid. Please let me know if I just need to install something additionally.
Hello,
Thanks for developing this plugin!
I wonder if you had considered adding support for code-signing the bundled application (and JRE, if embedded).
An example of the code signing process is laid out in the Gephi packaging script (written as a Maven Antrun goal):
https://github.com/gephi/gephi/blob/ac43719c48ef8b12d4dd5f3d15ef2f36443b9192/modules/application/pom.xml#L674-L822
It is a bit daunting but that is because they have some dependencies which use native code. For vanilla Java, it seems fairly straightforward.
Hi,
the federkasten version did have an option to include a previously downloaded JRE inside the app bundle. This doesn't seem to be possible here, or am I missing something?
Hi! I tried to copy the executable to the bundle using the additionalResources field, but after copying, the file lost executable privileges. Are there other ways to achieve this goal?
In order to create applications that run in system tray only, we need to be able to set LSUIElement to 1 in Info.plist. Can you please add support for this value in your plist configuration? Thanks!
By using the plugin as shown below:
<plugin>
<groupId>de.perdian.maven.plugins</groupId>
<artifactId>macosappbundler-maven-plugin</artifactId>
<version>1.7.0</version>
<configuration>
<jdk>
<include>true</include>
</jdk>
<plist>
<CFBundleIconFile>/src/main/resources/images/image.icns</CFBundleIconFile>
<JVMMainClassName>test.javafxTest.Main</JVMMainClassName>
<CFBundleDisplayName>TEST</CFBundleDisplayName>
</plist>
<dmg>
<generate>true</generate>
<dmgFileName>TEST</dmgFileName>
<appendVersion>true</appendVersion>
</dmg>
</configuration>
<dependencies>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>bundle</goal>
</goals>
</execution>
</executions>
</plugin>
The JDK is included but when I run the .app application it runs normally except that the JDK loads the UTF-8 raw application, so the application is displayed with special characters.
I can't find how to correct this problem.
Does anyone have any ideas?
I am unable to get the microphone input to work on an app I wrote. When running the program through the JVM directly, the microphone works. I suspect there is something wrong with the permissions, which may have changed when I switched over to Monterey.
Digging through material online, I found that this is related to entitlements com.apple.security.device.microphone and com.apple.security.device.audio-input, as well as a plist property NSCameraUsageDescription. Could you fix this, so that my bundled app can run and use the microphone?
Thanks
Hi,
after building (normal, no module) with maven i'm facing this issue:
I can run the app from shell with command: open -a myprogramm.app, but nothing happens when i try to launch it clicking on it... no errors, no messages.
jdk installed is openjdk 11 (with brew)
os Catalina
Thanks!
Hi,
Thanks for this initiative. It's a very cool project.
Would be really nice to have a "jLink" that would package a mini JRE image with Java9+ modules.
I think this would make the end DMG significantly smaller, compared to
<jdk>
<include>true</include>
</jdk>
Regards
Carlos
Enjoying this plugin. So easy to make a MacOS app out of my Java Swing app.
When I create a .app with the bundler plugin for my modular Java Swing app it works fine, but the button colors and some other UI colors wind up quite different from when I run it from the IDE or from an executable JAR file. It seems to be ignoring the colors I've set and choosing some rather bad colors instead. It's quite strange. Any idea what might be going on?
Thanks,
Jon
Hi,
while testing the generated .app
file on a friend's MacBook running the latest macOS 10.14, I got an error that the application requires macOS 10.15.
I assume the JavaLauncher
which afaik is in src/main/native
was compiled using 10.15.
I'd suggest using automated (Travis?) builds to compile the executable on multiple macOS versions and offering multiple versions of the app (where e.g. 1.3.0
is for the latest macOS, 1.3.0-hs
would be for high sierra, and so on) but this would probably cause errors in Maven repositories allowing -SNAPSHOT
versions.
I also can understand if you don't care about this.
I've been using this plugin for some time to build my MacOS App. I may not have built it for a while (a year or so maybe) and now when attempting to run the built app I get this error:
Cannot open JVM dynamic library at: /Users/xxx/Projects/xxx/target/xxx.app/Contents/Java/runtime/lib/libjli.dylib
I've been experimenting with different configurations with the latest one below. Nothing appears to make a difference. The app runs fine in the IDE and using the built jar
. The dylib
is present and returns ok with vtool
:
vtool -show-build /Users/xxx/Projects/xxx/target/xxx.app/Contents/Java/runtime/lib/libjli.dylib
/Users/xxx/Projects/xxx/target/xxx.app/Contents/Java/runtime/lib/libjli.dylib:
Load command 9
cmd LC_BUILD_VERSION
cmdsize 32
platform MACOS
minos 11.0
sdk 11.1
ntools 1
tool LD
version 609.8
Any help would be greatly appreciated, I'm running out of ideas of what might be causing it.
<plugin>
<groupId>de.perdian.maven.plugins</groupId>
<artifactId>macosappbundler-maven-plugin</artifactId>
<version>1.19.0</version>
<configuration>
<plist>
<CFBundleIconFile>src/main/resources/macos_icon.icns</CFBundleIconFile>
<CFBundleDisplayName>xxx</CFBundleDisplayName>
<CFBundleName>xxx</CFBundleName>
<CFBundleDevelopmentRegion>English</CFBundleDevelopmentRegion>
<JVMMainModuleName>xxx.xxx.xxx/xxx.xxx.xxx</JVMMainModuleName>
<JVMVersion>17+</JVMVersion>
<JVMOptions>
<string>-Dapple.laf.useScreenMenuBar=true</string>
<string>-Xdock:name=xxx</string>
</JVMOptions>
<JVMLogLevel>DEBUG</JVMLogLevel>
</plist>
<dmg>
<generate>false</generate>
</dmg>
<jdk>
<include>true</include>
<location>/Library/Java/JavaVirtualMachines/jdk-17.0.2.jdk/Contents/Home</location>
</jdk>
<nativeBinary>X86_64</nativeBinary>
<codesign>
<identity>xxx (xxx)</identity>
</codesign>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>bundle</goal>
</goals>
</execution>
</executions>
</plugin>
MacOS info:
ProductName: macOS
ProductVersion: 13.4
BuildVersion: 22F66
Hi. Great job with this plugin. I love it!
I am using it, but unfortunately my application is not starting - cannot find the main class.
I suspect it is because it is a Java 11 application.
It would be nice if you included an example of the parameter JVMMainModuleName
in your README. And also some debugging tips in case the app does not start.
Using genisoimage, I get a file named project.dmg instead of project_version.dmg.
I have always wondered why the resulting dmg file is so large. My impression is that the bundler uses a minimal JAR (2.5 MB in my case) and bundles all the referenced libraries with that JAR. As libraries have grown, I get a 42 MB dmg file now. The corresponding deb file and the Windows package are some 17 MB large.
So, could you add an option to use the shaded JAR instead of adding each and any file included in some referenced library?
In porting an application from Ant to Maven (and to more recent versions of Java), one feature of the JarBundler Ant task that this Maven plugin seems to lack any equivalent of is the ability to set up file associations.
In the Ant build.xml
, as a child of the <jarbundler>
element, I can write something like <documenttype name="My Custom App files" extensions="aaa bbb" role="Editor" />
, and looking at the plist file in the generated application bundle, that turns into
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>My Custom App files</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>aaa</string>
<string>bbb</string>
</array>
</dict>
</array>
But as far as I can tell, there's no way to put anything like this under the <plist>
element in pom.xml
, which would be a very desirable feature for packaging apps that are intended to serve as viewers or editors for files.
Hello,
Is it possible to add a single dependency (e.g. spring boot executable jar) from a different module?
I want to be able to build the jar (with all dependencies included) in a maven module A and build the DMG in a maven module B, and the content of the DMG should be the jar from maven module A.
I was trying to get this to work with this change:
akuhtz@3d53f68
But the build of my project fails with Command 'hdiutil' exited with status 1
and I don't know where to start the search for the cause.
Is there a way to change the working directory? Currently, the "user.dir" is within the app bundle itself.
Hey,
your example in README.md says 1.90.0 but it seems the current version is 1.19.0
by default you have appendVersion as true and it blocks use of dmgFileName and not transparent at all without plugin sources examination
When I launch from a bundled application, I get the wrong value for System.getProperty("user.dir")
, which is the working directory. I should get the parent directory of the application bundle. This should be the same value regardless of whether I launch the application bundle, or if I just copy the jar file to my directory and launch that. This makes testing much easier. But here's what I get:
App Bundle: /Users/myself/myFolder/MyApp.app
Jar file: /Users/myself/myFolder
(These are the results when the jar file and the bundle are in the same folder.)
The working directory should be the parent folder of the application bundle folder. That's how the original Mac application bundler worked.
This makes it harder to test my application in my IDE, because it uses a different value for the working directory.
I'm currently writing a project that uses JavaFX to display windows. Some of the resources it uses to do that (.fxml files) were not being included in the jar, so I used a different Maven plugin to shade the jar to include those resources.
Now that I want to create MacOS executables, it would be most convenient for me to simply package that JAR in the executable, rather than relying on this plugin to get all of the resources properly. Is this at all possible?
Follow the ideas laid out in https://keepachangelog.com/
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.