Hallo Forum,
Ich habe ein JavaFx Project, welches ich mit Maven zu einem ausführbaren Programm bilden möchte. Dies Funktioniert in der Regel mittlerweile auch, jedoch kamen nun Libaries mit nicht modularen Jars hinzu.
Ich habe hier im Forum schon Lösungsansätze gefunden, wie beispielsweise mit "Moditect" und habe versucht sie zu rekonstruieren. Allerdings zeigen sich beim bilden weiter die selben Fehlermeldungen: "Error: automatic module cannot be used with jlink: org.apache.commons.io from ...".
Anbei der dazugehörige Code, mit der bitte um Unterstützung.
Meine primäre Quelle hier aus dem Forum: Java Programm veröffentlichen am Besten modular
Ich habe ein JavaFx Project, welches ich mit Maven zu einem ausführbaren Programm bilden möchte. Dies Funktioniert in der Regel mittlerweile auch, jedoch kamen nun Libaries mit nicht modularen Jars hinzu.
Ich habe hier im Forum schon Lösungsansätze gefunden, wie beispielsweise mit "Moditect" und habe versucht sie zu rekonstruieren. Allerdings zeigen sich beim bilden weiter die selben Fehlermeldungen: "Error: automatic module cannot be used with jlink: org.apache.commons.io from ...".
Anbei der dazugehörige Code, mit der bitte um Unterstützung.
Meine primäre Quelle hier aus dem Forum: Java Programm veröffentlichen am Besten modular
XML:
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com</groupId>
<artifactId>orderview</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>oderview</name>
<description>des</description>
<properties>
<appName>OrderView</appName>
<launcherName>orderview</launcherName>
<moduleName>application</moduleName>
<mainClass>application.Main</mainClass>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>15</maven.compiler.source>
<maven.compiler.target>15</maven.compiler.target>
</properties>
<!-- DEPENDENCIES -->
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>15</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>15</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc -->
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.36.0.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.json/json-->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20220320</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.2.2</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.2</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<!-- COMPILE -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>15</release>
</configuration>
</plugin>
<!-- IMAGE -->
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.5</version>
<configuration>
<release>11</release>
<jlinkImageName>OrderView</jlinkImageName>
<launcher>orderview</launcher>
<mainClass>orderview/application.Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<!-- NON-MODULARS / MODITECT -->
<profiles>
<profile>
<id>app</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.2</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/modules</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.moditect</groupId>
<artifactId>moditect-maven-plugin</artifactId>
<version>1.0.0.RC1</version>
<executions>
<execution>
<id>add-doule-info-to-dependencies</id>
<phase>package</phase>
<configuration>
<outputDirectory>${project.build.directory}/modules</outputDirectory>
<overwriteExistingFiles>true</overwriteExistingFiles>
<modules>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-collections4 -->
<module>
<artifact>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.4</version>
</artifact>
<moduleInfo>
<name>commons-collections4</name>
</moduleInfo>
</module>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-math3 -->
<module>
<artifact>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>3.6.1</version>
</artifact>
<moduleInfo>
<name>commons-math3</name>
</moduleInfo>
</module>
<module>
<artifact>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</artifact>
<moduleInfo>
<name>commons-io</name>
</moduleInfo>
</module>
<module>
<artifact>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-compress -->
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.3</version>
</artifact>
<moduleInfo>
<name>commons-compress</name>
</moduleInfo>
</module>
<module>
<artifact>
<!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.15</version>
</artifact>
<moduleInfo>
<name>commons-codec</name>
</moduleInfo>
</module>
<module>
<artifact>
<!-- https://mvnrepository.com/artifact/com.zaxxer/SparseBitSet -->
<groupId>com.zaxxer</groupId>
<artifactId>SparseBitSet</artifactId>
<version>1.2</version>
</artifact>
<moduleInfo>
<name>SparseBitSet</name>
</moduleInfo>
</module>
</modules>
<module>
<mainClass>${mainClass}</mainClass>
<moduleInfo>${project.build.sourceDirectory}/module-info.java</moduleInfo>
</module>
</configuration>
<goals>
<goal>add-module-info</goal>
</goals>
</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>${moduleName}</module>
</modules>
<launcher>
<name>${launcherName}</name>
<module>${moduleName}</module>
</launcher>
<compression>2</compression>
<stripDebug>true</stripDebug>
<outputDirectory>${project.build.directory}/jlink-image</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.akman</groupId>
<artifactId>jpackage-maven-plugin</artifactId>
<version>0.1.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jpackage</goal>
</goals>
<configuration>
<name>${appName}</name>
<type>IMAGE</type>
<runtimeimage>$project.build.directory}/jlink-image</runtimeimage>
<module>${moduleName/}/${mainClass}</module>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Java:
module orderview {
requires javafx.fxml;
requires javafx.controls;
requires javafx.graphics;
requires java.sql;
requires org.json;
requires org.apache.poi.poi;
requires org.apache.poi.ooxml;
requires org.apache.commons.collections4; // nur als Versuch, wird nicht direkt benötigt
exports application;
opens application;
exports database;
exports download;
exports inEx;
exports user;
}