Skip to content

Instantly share code, notes, and snippets.

@PoslavskySV
Created September 14, 2020 15:15
Show Gist options
  • Save PoslavskySV/6412819823aed5b8177810b50ea89320 to your computer and use it in GitHub Desktop.
Save PoslavskySV/6412819823aed5b8177810b50ea89320 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>com.example</groupId>
<artifactId>z</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<module.mainClass>com.example.z.Main</module.mainClass>
<module.name>myAwesomeModule</module.name>
</properties>
<dependencies>
<dependency>
<groupId>info.picocli</groupId>
<artifactId>picocli</artifactId>
<version>4.1.2</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>14</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>14</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-swing</artifactId>
<version>14</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<outputDirectory>
${project.build.directory}/modules
</outputDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.2</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/modules</outputDirectory>
<includeScope>runtime</includeScope>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.moditect</groupId>
<artifactId>moditect-maven-plugin</artifactId>
<version>1.0.0.RC1</version>
<executions>
<execution>
<id>add-module-info</id>
<phase>package</phase>
<goals>
<goal>add-module-info</goal>
</goals>
<configuration>
<overwriteExistingFiles>true</overwriteExistingFiles>
<buildDirectory>${project.build.directory}/modules</buildDirectory>
<outputDirectory>${project.build.directory}/modules</outputDirectory>
<jvmVersion>14</jvmVersion>
<modules>
<module>
<artifact>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</artifact>
<moduleInfoSource>
module xml.apis {}
</moduleInfoSource>
</module>
<module>
<artifact>
<groupId>info.picocli</groupId>
<artifactId>picocli</artifactId>
</artifact>
<moduleInfoSource>
open module info.picocli {
exports picocli;
}
</moduleInfoSource>
</module>
</modules>
<module>
<mainClass>${module.mainClass}</mainClass>
<moduleInfoSource>
open module ${module.name} {
requires java.desktop;
requires info.picocli;
exports com.example.something;
}
</moduleInfoSource>
</module>
<jdepsExtraArgs>
<arg>--multi-release</arg>
<arg>14</arg>
<arg>--ignore-missing-deps</arg>
</jdepsExtraArgs>
</configuration>
</execution>
<execution>
<id>create-runtime-image</id>
<phase>package</phase>
<goals>
<goal>create-runtime-image</goal>
</goals>
<configuration>
<modulePath>
<path>${project.build.directory}/modules</path>
</modulePath>
<modules>
<module>${module.name}</module>
</modules>
<launcher>
<name>launcher</name>
<module>${module.name}/${module.mainClass}</module>
</launcher>
<ignoreSigningInformation>true</ignoreSigningInformation>
<compression>2</compression>
<stripDebug>true</stripDebug>
<outputDirectory>${project.build.directory}/jlink-image</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${java.home}/bin/java</executable>
<arguments>
<argument>--module-path</argument>
<argument>
${project.build.directory}/modules
</argument>
<argument>--module</argument>
<argument>${module.name}/${module.mainClass}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<executions>
<execution>
<id>process-annotations</id>
<phase>generate-sources</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<source>14</source>
<target>14</target>
<includes>
<include>com/example/ogogo/model/**</include>
</includes>
<generatedSourcesDirectory>
${project.build.directory}/generated-sources/
</generatedSourcesDirectory>
</configuration>
</execution>
<execution>
<id>default-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
<configuration>
<compilerArgs>
<arg>-proc:none</arg>
</compilerArgs>
</configuration>
</execution>
</executions>
<configuration>
<source>14</source>
<target>14</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment