add jpackage profile to build a macos app
This commit is contained in:
@@ -110,4 +110,77 @@
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
<profiles>
|
||||
<!-- builds a native .app bundle. jpackage can only target the os it runs on:
|
||||
run this profile on macos with `mvn clean package -Pmac-app` -->
|
||||
<profile>
|
||||
<id>mac-app</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.5.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>stage-jpackage-input</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}/jpackage-input</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${project.build.directory}</directory>
|
||||
<includes>
|
||||
<include>${project.build.finalName}-jar-with-dependencies.jar</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>3.6.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>jpackage-app-image</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>${java.home}/bin/jpackage</executable>
|
||||
<arguments>
|
||||
<argument>--type</argument>
|
||||
<argument>app-image</argument>
|
||||
<argument>--name</argument>
|
||||
<argument>${project.artifactId}</argument>
|
||||
<argument>--dest</argument>
|
||||
<argument>${project.build.directory}/jpackage</argument>
|
||||
<argument>--input</argument>
|
||||
<argument>${project.build.directory}/jpackage-input</argument>
|
||||
<argument>--main-jar</argument>
|
||||
<argument>${project.build.finalName}-jar-with-dependencies.jar</argument>
|
||||
<argument>--main-class</argument>
|
||||
<argument>wtf.beatrice.autosqueal.Main</argument>
|
||||
<argument>--mac-package-identifier</argument>
|
||||
<argument>wtf.beatrice.autosqueal</argument>
|
||||
<argument>--mac-package-name</argument>
|
||||
<argument>autosqueal</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -29,6 +29,10 @@
|
||||
2. `cd` into the directory and run `mvn clean package`.
|
||||
3. you will find a runnable jar with dependencies in the `target/` folder.
|
||||
4. run the built jar file with `java -jar target/autosqueal-*-jar-with-dependencies.jar`.
|
||||
|
||||
**macos .app bundle**
|
||||
- on macos, run `mvn clean package -Pmac-app`: you will find `autosqueal.app` in `target/jpackage/`.
|
||||
- the first time you run it, grant it the accessibility and screen recording permissions in system settings, like any other java app.
|
||||
|
||||
## support
|
||||
| category | info |
|
||||
|
||||
Reference in New Issue
Block a user