Skip to content

Instantly share code, notes, and snippets.

@AIGLEZMA
Created December 24, 2021 22:43
Show Gist options
  • Save AIGLEZMA/6b9f19345fc7e6811daa67da1a642024 to your computer and use it in GitHub Desktop.
Save AIGLEZMA/6b9f19345fc7e6811daa67da1a642024 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>me.aiglez</groupId>
<artifactId>disamper-solar</artifactId>
<version>1.0-SNAPSHOT</version>
<!-- This description text is included in the Windows installer by default, see win-jpackage.txt -->
<description>Dimensionner facilement</description>
<properties>
<!-- Set this to the class with the main method for your application -->
<main-class>me.aiglez.disamper.solar.AppKt</main-class>
<!-- Change your app's name to something interesting... but you might want to avoid spaces
just to safe for compatibility across operating systems. -->
<app.name>Solaire</app.name>
<!-- This converts the build timestamp to a Windows-installer friendly version number (minute level resolution).
Note that Maven generated timestamp is in UTC, not local time. For more information see:
https://docs.microsoft.com/en-us/windows/win32/msi/productversion
https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/text/SimpleDateFormat.html
-->
<maven.build.timestamp.format>yy.ww.WWkkmm</maven.build.timestamp.format>
<app.version>${maven.build.timestamp}</app.version>
<!-- This property is used to specify the modules included in the (custom) JVM image. -->
<!-- Reminder: javafx.web (the embedded browser component) is not included in this project by default due
to GitHub template size restrictions. You can download the full SDK from https://openjfx.io -->
<jvm.modules>javafx.media,javafx.controls,javafx.fxml,java.logging</jvm.modules>
<!-- Set the project to UTF-8, avoiding warnings in the build logs -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>16</maven.compiler.source>
<maven.compiler.target>16</maven.compiler.target>
<!-- Used to set both the path to find the JavaFX modules and also the versions for Maven dependencies -->
<javafx.version>16</javafx.version>
<!-- Replace this UUID with a custom one for your project. This ID is used by the Windows installer system
to know that an installer is intended to replace/upgrade an earlier version. The easiest thing to do is
grab a unique UUID via https://www.uuidgenerator.net -->
<windows.upgrade.uuid></windows.upgrade.uuid>
<!-- This is used to set many user-visible fields in the Windows Installer. See win-jpackage.txt -->
<windows.vendor>Disamper</windows.vendor>
</properties>
<dependencies>
<!-- Kotlin dependency -->
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>1.5.32</version>
</dependency>
<!-- JMetro dependency -->
<dependency>
<groupId>org.jfxtras</groupId>
<artifactId>jmetro</artifactId>
<version>11.6.15</version>
<exclusions>
<exclusion>
<artifactId>javafx-base</artifactId>
<groupId>org.openjfx</groupId>
</exclusion>
<exclusion>
<artifactId>javafx-controls</artifactId>
<groupId>org.openjfx</groupId>
</exclusion>
<exclusion>
<artifactId>javafx-graphics</artifactId>
<groupId>org.openjfx</groupId>
</exclusion>
<exclusion>
<artifactId>javafx-web</artifactId>
<groupId>org.openjfx</groupId>
</exclusion>
<exclusion>
<artifactId>javafx-media</artifactId>
<groupId>org.openjfx</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- TornadoFX dependency -->
<dependency>
<groupId>no.tornado</groupId>
<artifactId>tornadofx</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
<!-- ControlsFX dependency -->
<dependency>
<groupId>org.controlsfx</groupId>
<artifactId>controlsfx</artifactId>
<version>11.1.0</version>
</dependency>
<!-- This downloads the platform specific JavaFX libraries used by the project. -->
<!-- For the final installable, the JavaFX dependencies are provided via modules, but by including these here
they work nicely with with IDEs and other Maven plugins (e.g. the javafx:run). -->
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>${javafx.version}</version>
<classifier>${platform}</classifier>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>${javafx.version}</version>
<classifier>${platform}</classifier>
<exclusions>
<exclusion>
<artifactId>javafx-base</artifactId>
<groupId>org.openjfx</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>${javafx.version}</version>
<classifier>${platform}</classifier>
<exclusions>
<exclusion>
<artifactId>javafx-controls</artifactId>
<groupId>org.openjfx</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<repositories>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
<repository>
<id>mvn-repository</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>
</repositories>
<build>
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
<resources>
<resource>
<!-- Here we are processing the platform-specific jpackage command files, adding in Maven
properties for configuration. -->
<directory>${project.basedir}/src/packaging</directory>
<filtering>true</filtering>
<targetPath>${project.build.directory}/packaging</targetPath>
</resource>
<!-- Add the default resource path back in - by overriding above it disables the default -->
<resource>
<directory>${project.basedir}/src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>1.5.32</version>
<executions>
<execution>
<id>compile</id>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<configuration>
<jvmTarget>1.8</jvmTarget>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<configuration>
<!-- This is an app, so we don't want to install it in the local Maven repository -->
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<!-- This copies all of the jar files declared by the Maven build into a single directory.
This makes it easy to assemble the final installer package -->
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<!-- The JavaFX libraries are bundled into the custom JVM, so we don't want to duplicate
them in the bundled app and installer. This command skips all of the JavaFX by groupId. -->
<excludeGroupIds>org.openjfx</excludeGroupIds>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<!-- Put the application jar generated by the project into the dependency folder - the default folder
for the maven-dependency-plugin output. -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<outputDirectory>${project.build.directory}/dependency</outputDirectory>
</configuration>
</plugin>
<plugin>
<!-- Plugin to make working with JavaFX nicer. See https://github.com/openjfx/javafx-maven-plugin -->
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
<configuration>
<mainClass>${main-class}</mainClass>
</configuration>
</plugin>
<plugin>
<!-- https://github.com/wiverson/jtoolprovider-plugin -->
<groupId>io.github.wiverson</groupId>
<artifactId>jtoolprovider-plugin</artifactId>
<version>1.0.34</version>
<executions>
<!-- This command runs jlink, generating a custom JVM by combining the JavaFX modules bundled in
this project with the JDK modules. -->
<execution>
<id>jlink</id>
<phase>package</phase>
<goals>
<goal>java-tool</goal>
</goals>
<configuration>
<toolName>jlink</toolName>
<removeDirectories>${project.build.directory}/jvm-image/</removeDirectories>
<modulePath>${project.basedir}/${platform}-javafx/javafx-jmods-${javafx.version}/
</modulePath>
<addModules>${jvm.modules}</addModules>
<output>${project.build.directory}/jvm-image</output>
<args>
<arg>--strip-native-commands</arg>
<arg>--no-header-files</arg>
<arg>--strip-debug</arg>
<arg>--no-man-pages</arg>
<arg>--compress=2</arg>
</args>
</configuration>
</execution>
<!-- The command that actually generates the installer. The options for each platform
are found the /src/packaging directory. These files are copied into the target directory by
the Maven resources plugin, which does the filtering to replace the original values with
the actual Maven properties.
https://github.com/wiverson/jtoolprovider-plugin/blob/main/java-tool-doc.md
-->
<execution>
<id>jpackage</id>
<phase>install</phase>
<goals>
<goal>java-tool</goal>
</goals>
<configuration>
<toolName>jpackage</toolName>
<removeDirectories>${project.build.directory}/installer-work</removeDirectories>
<args>@${project.build.directory}/packaging/${platform}-jpackage.txt</args>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.0-M1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.1.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.9.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<reporting>
<plugins>
<!-- http://mojo.codehaus.org/versions-maven-plugin/version-rules.html -->
<!-- This plugin is a utility to find outdated dependencies in your project. Just run mvn site and
the resulting HTML reports in target/site will let you know what plugins and dependencies are out of date.
-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.8.1</version>
<reportSets>
<reportSet>
<reports>
<report>dependency-updates-report</report>
<report>plugin-updates-report</report>
<report>property-updates-report</report>
</reports>
</reportSet>
</reportSets>
<configuration>
<processDependencyManagementTransitive>false</processDependencyManagementTransitive>
</configuration>
</plugin>
</plugins>
</reporting>
<profiles>
<!-- We use the built-in Maven profile activation system to set the platform property.
These properties are then use to build the directory paths to the platform specific resources.
It would be great if Maven automatically added the os family as a property by default
-->
<profile>
<id>unix-active</id>
<activation>
<os>
<family>unix</family>
</os>
</activation>
<properties>
<platform>linux</platform>
</properties>
</profile>
<profile>
<id>windows-active</id>
<activation>
<os>
<family>windows</family>
</os>
</activation>
<properties>
<platform>win</platform>
</properties>
<build>
<plugins>
<plugin>
<!-- This adds a "launch on finish" to the Windows msi installer. This just tweaks the Windows
installer package to run the executable after the installer runs, simplifying the user experience.
If you don't want this behavior, just delete this plug execution. -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>install</phase>
<id>add-launch-to-msi</id>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>cscript</executable>
<outputFile>${project.build.directory}/msi-result.log</outputFile>
<workingDirectory>${project.build.directory}</workingDirectory>
<arguments>
<argument>${project.build.directory}/packaging/add-launch-to-msi.js</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>mac-active</id>
<activation>
<os>
<family>mac</family>
</os>
</activation>
<properties>
<platform>mac</platform>
</properties>
</profile>
</profiles>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment