Test to have a direct jpackage call inside the project.
This commit is contained in:
parent
b4d325b26c
commit
5e7900647d
296
pom.xml
296
pom.xml
@ -21,6 +21,7 @@
|
||||
<main.module>FXAppModule</main.module>
|
||||
<java.version>17</java.version>
|
||||
<required.maven.version>3.6.3</required.maven.version>
|
||||
<jar.file>javafxapp</jar.file>
|
||||
|
||||
<!-- Dependency versions -->
|
||||
<junit.version>5.9.1</junit.version>
|
||||
@ -52,6 +53,7 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<maven.compiler.release>${java.version}</maven.compiler.release>
|
||||
|
||||
</properties>
|
||||
|
||||
@ -66,6 +68,11 @@
|
||||
<artifactId>javafx-graphics</artifactId>
|
||||
<version>${javafx.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-fxml</artifactId>
|
||||
<version>${javafx.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-web</artifactId>
|
||||
@ -108,6 +115,7 @@
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${jar.file}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
@ -191,208 +199,6 @@
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>${maven.dependency.plugin}</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>${moditect.maven.plugin}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-module-info-to-dependencies</id>
|
||||
<phase>package</phase>
|
||||
<configuration>
|
||||
<jvmVersion>${java.version}</jvmVersion>
|
||||
<outputDirectory>${project.build.directory}/modules</outputDirectory>
|
||||
<overwriteExistingFiles>true</overwriteExistingFiles>
|
||||
<modules>
|
||||
<!--
|
||||
<module>
|
||||
<artifact>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
</artifact>
|
||||
<moduleInfo>
|
||||
<name>org.apache.logging.log4j.core</name>
|
||||
</moduleInfo>
|
||||
</module>
|
||||
-->
|
||||
|
||||
<module>
|
||||
<artifact>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
</artifact>
|
||||
<moduleInfoSource>
|
||||
open module org.apache.logging.log4j.core {
|
||||
requires java.logging;
|
||||
requires java.rmi;
|
||||
|
||||
requires transitive java.compiler;
|
||||
requires transitive java.desktop;
|
||||
requires transitive java.management;
|
||||
requires transitive java.naming;
|
||||
requires transitive java.scripting;
|
||||
requires transitive java.sql;
|
||||
requires transitive java.xml;
|
||||
|
||||
requires org.apache.logging.log4j;
|
||||
|
||||
exports org.apache.logging.log4j.core;
|
||||
exports org.apache.logging.log4j.core.appender;
|
||||
exports org.apache.logging.log4j.core.appender.db;
|
||||
exports org.apache.logging.log4j.core.appender.db.jdbc;
|
||||
exports org.apache.logging.log4j.core.appender.mom;
|
||||
exports org.apache.logging.log4j.core.appender.mom.jeromq;
|
||||
exports org.apache.logging.log4j.core.appender.mom.kafka;
|
||||
exports org.apache.logging.log4j.core.appender.nosql;
|
||||
exports org.apache.logging.log4j.core.appender.rewrite;
|
||||
exports org.apache.logging.log4j.core.appender.rolling;
|
||||
exports org.apache.logging.log4j.core.appender.rolling.action;
|
||||
exports org.apache.logging.log4j.core.appender.routing;
|
||||
exports org.apache.logging.log4j.core.async;
|
||||
exports org.apache.logging.log4j.core.config;
|
||||
exports org.apache.logging.log4j.core.config.arbiters;
|
||||
exports org.apache.logging.log4j.core.config.builder.api;
|
||||
exports org.apache.logging.log4j.core.config.builder.impl;
|
||||
exports org.apache.logging.log4j.core.config.composite;
|
||||
exports org.apache.logging.log4j.core.config.json;
|
||||
exports org.apache.logging.log4j.core.config.plugins;
|
||||
exports org.apache.logging.log4j.core.config.plugins.convert;
|
||||
exports org.apache.logging.log4j.core.config.plugins.processor;
|
||||
exports org.apache.logging.log4j.core.config.plugins.util;
|
||||
exports org.apache.logging.log4j.core.config.plugins.validation;
|
||||
exports org.apache.logging.log4j.core.config.plugins.validation.constraints;
|
||||
exports org.apache.logging.log4j.core.config.plugins.validation.validators;
|
||||
exports org.apache.logging.log4j.core.config.plugins.visitors;
|
||||
exports org.apache.logging.log4j.core.config.properties;
|
||||
exports org.apache.logging.log4j.core.config.status;
|
||||
exports org.apache.logging.log4j.core.config.xml;
|
||||
exports org.apache.logging.log4j.core.config.yaml;
|
||||
exports org.apache.logging.log4j.core.filter;
|
||||
exports org.apache.logging.log4j.core.filter.mutable;
|
||||
exports org.apache.logging.log4j.core.impl;
|
||||
exports org.apache.logging.log4j.core.jackson;
|
||||
exports org.apache.logging.log4j.core.jmx;
|
||||
exports org.apache.logging.log4j.core.layout;
|
||||
exports org.apache.logging.log4j.core.layout.internal;
|
||||
exports org.apache.logging.log4j.core.lookup;
|
||||
exports org.apache.logging.log4j.core.message;
|
||||
exports org.apache.logging.log4j.core.net;
|
||||
exports org.apache.logging.log4j.core.net.ssl;
|
||||
exports org.apache.logging.log4j.core.osgi;
|
||||
exports org.apache.logging.log4j.core.parser;
|
||||
exports org.apache.logging.log4j.core.pattern;
|
||||
exports org.apache.logging.log4j.core.script;
|
||||
exports org.apache.logging.log4j.core.selector;
|
||||
exports org.apache.logging.log4j.core.time;
|
||||
exports org.apache.logging.log4j.core.time.internal;
|
||||
exports org.apache.logging.log4j.core.tools;
|
||||
exports org.apache.logging.log4j.core.tools.picocli;
|
||||
exports org.apache.logging.log4j.core.util;
|
||||
exports org.apache.logging.log4j.core.util.datetime;
|
||||
exports org.apache.logging.log4j.core.util.internal;
|
||||
|
||||
uses org.apache.logging.log4j.core.util.WatchEventService;
|
||||
uses org.apache.logging.log4j.core.util.ContextDataProvider;
|
||||
|
||||
provides javax.annotation.processing.Processor with
|
||||
org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor;
|
||||
provides org.apache.logging.log4j.message.ThreadDumpMessage.ThreadInfoFactory with
|
||||
org.apache.logging.log4j.core.message.ExtendedThreadInfoFactory;
|
||||
provides org.apache.logging.log4j.spi.Provider with
|
||||
org.apache.logging.log4j.core.impl.Log4jProvider;
|
||||
|
||||
provides org.apache.logging.log4j.core.util.ContextDataProvider with
|
||||
org.apache.logging.log4j.core.impl.ThreadContextDataProvider;
|
||||
}
|
||||
</moduleInfoSource>
|
||||
</module>
|
||||
|
||||
</modules>
|
||||
|
||||
<module>
|
||||
<mainClass>${main.class}</mainClass>
|
||||
<moduleInfoFile>${project.build.sourceDirectory}/module-info.java</moduleInfoFile>
|
||||
</module>
|
||||
|
||||
<jdepsExtraArgs>
|
||||
<arg>--ignore-missing-deps</arg>
|
||||
<arg>--multi-release</arg>
|
||||
<arg>${java.version}</arg>
|
||||
</jdepsExtraArgs>
|
||||
</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>${main.module}</module>
|
||||
</modules>
|
||||
<launcher>
|
||||
<name>${launcher}</name>
|
||||
<module>${main.module}</module>
|
||||
</launcher>
|
||||
<bindServices>true</bindServices>
|
||||
<compression>2</compression>
|
||||
<!-- <jarInclusionPolicy>NONE</jarInclusionPolicy> -->
|
||||
<jarInclusionPolicy>APP_WITH_DEPENDENCIES</jarInclusionPolicy>
|
||||
<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>${jpackage.maven.plugin}</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>${main.module}/${main.class}</module>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>com.github.spotbugs</groupId>
|
||||
<artifactId>spotbugs-maven-plugin</artifactId>
|
||||
@ -484,6 +290,92 @@
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>${maven.dependency.plugin}</version>
|
||||
<executions>
|
||||
<!-- erstmal Abhängigkeiten für den Class-Path kopieren -->
|
||||
<execution>
|
||||
<id>copy-dependencies</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}/modules</outputDirectory>
|
||||
<excludeGroupIds>org.openjfx</excludeGroupIds>
|
||||
<includeScope>runtime</includeScope>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>${project.artifactId}</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>${project.packaging}</type>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
<overWriteReleases>false</overWriteReleases>
|
||||
<overWriteSnapshots>false</overWriteSnapshots>
|
||||
<overWriteIfNewer>true</overWriteIfNewer>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
||||
<!-- dazu noch das Projekt-JAR -->
|
||||
<execution>
|
||||
<id>copy</id>
|
||||
<phase>install</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}/modules</outputDirectory>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>${project.artifactId}</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>${project.packaging}</type>
|
||||
<destFileName>${project.build.finalName}.jar</destFileName>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
<overWriteIfNewer>true</overWriteIfNewer>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>com.github.akman</groupId>
|
||||
<artifactId>jpackage-maven-plugin</artifactId>
|
||||
<version>${jpackage.maven.plugin}</version>
|
||||
<configuration>
|
||||
<name>${appName}</name>
|
||||
<type>IMAGE</type>
|
||||
<modulepath>
|
||||
<dependencysets>
|
||||
<dependencyset>
|
||||
<includenames>
|
||||
<includename>javafx\..*</includename>
|
||||
</includenames>
|
||||
</dependencyset>
|
||||
</dependencysets>
|
||||
</modulepath>
|
||||
<addmodules>
|
||||
<addmodule>javafx.controls</addmodule>
|
||||
</addmodules>
|
||||
<mainclass>${main.class}</mainclass>
|
||||
<input>${project.build.directory}/modules</input>
|
||||
<mainjar>${jar.file}.jar</mainjar>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>install</phase>
|
||||
<goals>
|
||||
<goal>jpackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@ -1,33 +1,42 @@
|
||||
package de.kneitzel;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.application.Platform;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.stage.Stage;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class JavaFXApp extends Application {
|
||||
static final Logger logger = LogManager.getLogger(JavaFXApp.class);
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) {
|
||||
public void start(Stage primaryStage) throws IOException {
|
||||
|
||||
primaryStage.setTitle("Hello World!");
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("MainWindow.fxml"));
|
||||
Parent root = fxmlLoader.load();
|
||||
primaryStage.setScene(new Scene(root));
|
||||
primaryStage.show();
|
||||
/*
|
||||
Button btn = new Button();
|
||||
btn.setText("Say 'Hello World'");
|
||||
btn.setOnAction(e -> System.out.println("Hello World!"));
|
||||
|
||||
StackPane root = new StackPane();
|
||||
root.getChildren().add(btn);
|
||||
primaryStage.setScene(new Scene(root, 300, 250));
|
||||
primaryStage.show();
|
||||
*/
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
logger.warn("Starting ...");
|
||||
launch(args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
30
src/main/java/de/kneitzel/MainWindow.java
Normal file
30
src/main/java/de/kneitzel/MainWindow.java
Normal file
@ -0,0 +1,30 @@
|
||||
package de.kneitzel;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.TextField;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class MainWindow implements Initializable {
|
||||
|
||||
@FXML
|
||||
private TextField textField;
|
||||
public Button button;
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle resourceBundle) {
|
||||
if (button == null) {
|
||||
textField.setText("Button is null");
|
||||
} else {
|
||||
textField.setText("Button is not null");
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void onButtonClick(ActionEvent actionEvent) {
|
||||
|
||||
}
|
||||
}
|
||||
@ -3,6 +3,7 @@ module FXAppModule {
|
||||
requires javafx.graphics;
|
||||
requires javafx.controls;
|
||||
requires javafx.web;
|
||||
requires javafx.fxml;
|
||||
requires org.apache.logging.log4j;
|
||||
requires org.apache.logging.log4j.core;
|
||||
|
||||
|
||||
11
src/main/resources/de/kneitzel/MainWindow.fxml
Normal file
11
src/main/resources/de/kneitzel/MainWindow.fxml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
|
||||
<AnchorPane prefHeight="127.0" prefWidth="209.0" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.kneitzel.MainWindow">
|
||||
<children>
|
||||
<Button fx:id="button" layoutX="44.0" layoutY="70.0" mnemonicParsing="false" onAction="#onButtonClick" text="Button" />
|
||||
<TextField fx:id="textField" layoutX="14.0" layoutY="24.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
Loading…
x
Reference in New Issue
Block a user