Skip to content

Commit

Permalink
refactor(POM) to Improve Build Configuration for macOS and Windows
Browse files Browse the repository at this point in the history
- (Re-)Added former properties to POM:
  - zkn.launch4jVersion for setting Launch4j version.
  - zkn.supportsDmg to control DMG generation.
  - zkn.useGenIsoImage to control use of GenIsoImage.

- Replaced maven-jar-plugin with macosappbundler-maven-plugin:
  - Configured macOS application bundle generation.
  - Added plist and dmg configuration for macOS builds.

- Replaced maven-assembly-plugin with maven-shade-plugin:
  - Configured Maven Shade Plugin for creating fat JARs.
  - Added transformer to set the main class in the manifest.

- Added launch4j-maven-plugin for Windows EXE packaging:
  - Configured Launch4j for generating Windows executables.
  - Set application metadata, icons, and splash screen configuration.

- Updated JavaFX dependencies:
  - Changed version of javafx-web dependency from 16-ea+7 to 11 for compatibility.

This commit improves the build process by adding support for creating native bundles for both macOS and Windows, streamlining the configuration, and enhancing the flexibility of the build process.
  • Loading branch information
RalfBarkow committed Jun 7, 2024
1 parent f6c96d3 commit 5fd0500
Showing 1 changed file with 86 additions and 43 deletions.
129 changes: 86 additions & 43 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
<name>Zettelkasten</name>
<properties>
<exec.mainClass>de.danielluedecke.zettelkasten.ZettelkastenApp</exec.mainClass>
<zkn.launch4jVersion>${project.version}.0</zkn.launch4jVersion>
<zkn.supportsDmg>false</zkn.supportsDmg>
<zkn.useGenIsoImage>false</zkn.useGenIsoImage>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<slf4j.version>2.0.13</slf4j.version>
</properties>
Expand Down Expand Up @@ -152,72 +155,112 @@
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.4.1</version>
<groupId>de.perdian.maven.plugins</groupId>
<artifactId>macosappbundler-maven-plugin</artifactId>
<version>1.10.0</version>
<configuration>
<archive>
<index>true</index>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
<manifestEntries>
<mode>development</mode>
<url>${project.url}</url>
<key>value</key>
</manifestEntries>
</archive>
<jdk>
<include>false</include>
<!-- <location>target/jre</location> maybe an option for later-->
</jdk>
<plist>
<CFBundleDisplayName>${project.name}</CFBundleDisplayName>
<JVMMainClassName>de.danielluedecke.zettelkasten.ZettelkastenApp</JVMMainClassName>
<JVMVersion>8+</JVMVersion>
<CFBundleDevelopmentRegion>German</CFBundleDevelopmentRegion>
<CFBundleName>${project.name}</CFBundleName>
<CFBundleDisplayName>${project.name}</CFBundleDisplayName>
<CFBundleIdentifier>de.danielluedecke.zettelkasten.ZettelkastenApp</CFBundleIdentifier>
<CFBundleShortVersionString>${project.version}</CFBundleShortVersionString>
<CFBundleIconFile>src/main/resources/logo/zkn3_2.icns</CFBundleIconFile>
</plist>
<dmg>
<generate>${zkn.supportsDmg}</generate>
<useGenIsoImage>${zkn.useGenIsoImage}</useGenIsoImage>
</dmg>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>bundle</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- creates runnable fat jar: Zettelkasten-3.2024.06-jar-with-dependencies.jar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.7.1</version>
<configuration>
<archive>
<manifest>
<mainClass>${exec.mainClass}</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>de.danielluedecke.zettelkasten.ZettelkastenApp</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.github.fvarrui</groupId>
<artifactId>javapackager</artifactId>
<version>1.7.5</version>
<groupId>com.akathist.maven.plugins.launch4j</groupId>
<artifactId>launch4j-maven-plugin</artifactId>
<version>2.5.0</version>
<executions>
<execution>
<id>launch4j</id>
<phase>package</phase>
<goals>
<goal>package</goal>
<goal>launch4j</goal>
</goals>
<configuration>
<mainClass>${exec.mainClass}</mainClass>
<dontWrapJar>false</dontWrapJar>
<headerType>gui</headerType>
<jar>target/${project.build.finalName}.jar</jar>
<outfile>target/${project.build.finalName}.exe</outfile>
<chdir>.</chdir>
<priority>normal</priority>
<downloadUrl>http://java.com/download</downloadUrl>
<stayAlive>false</stayAlive>
<restartOnCrash>false</restartOnCrash>
<manifest/>
<icon>src/main/resources/logo/zkn2.ico</icon>
<jre>
<minVersion>1.7.0</minVersion>
<bundledJre64Bit>false</bundledJre64Bit>
<bundledJreAsFallback>false</bundledJreAsFallback>
<jdkPreference>preferJre</jdkPreference>
<runtimeBits>32/64</runtimeBits>
</jre>
<splash>
<file>src/main/resources/logo/splash.bmp</file>
<waitForWindow>true</waitForWindow>
<timeout>60</timeout>
<timeoutErr>true</timeoutErr>
</splash>
<versionInfo>
<fileVersion>${zkn.launch4jVersion}</fileVersion>
<txtFileVersion>Zettelkasten 3</txtFileVersion>
<fileDescription>Zettelkasten - nach Niklas Luhmann</fileDescription>
<copyright>Daniel Luedecke</copyright>
<productVersion>${zkn.launch4jVersion}</productVersion>
<txtProductVersion>${project.version}</txtProductVersion>
<productName>${project.build.finalName}</productName>
<internalName>zkn</internalName>
<originalFilename>${project.build.finalName}.exe</originalFilename>
</versionInfo>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
Expand Down Expand Up @@ -379,7 +422,7 @@
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-web</artifactId>
<version>16-ea+7</version>
<version>11</version>
<type>jar</type>
</dependency>
</dependencies>
Expand Down

0 comments on commit 5fd0500

Please sign in to comment.