diff --git a/README.md b/README.md
index 35c8273..ad19131 100644
--- a/README.md
+++ b/README.md
@@ -2,9 +2,14 @@
Example Maven Project for a JavaFX Application.
-Maven modules are configured so that even Images are built (including JPackage app-image).
+This projects includes multiple plugins:
+- Static code analysis with PMD and Spotbugs
+- Check of dependency updates during build
+- Build of an App-Image using JPackage
-Project includes PMD and spotbugs!
+The application is no longer a modular application so there are no problems with dependencies that are not providing a
+module-info.
-**Important**: Using moditect to add module descriptions is not required. New solution to create images through jpackage will be commited soon.
-Check branch direct-jpackage to see the current test project I build.
+** Build the Image **
+To build the image, the profile Image must be used:
+```./mvnw -DImage install```
diff --git a/pom.xml b/pom.xml
index e7c72ea..5bf0b37 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,17 +17,17 @@
${project.artifactId}
${project.artifactId}
${project.artifactId}
- de.kneitzel.JavaFXApp
- FXAppModule
+ de.kneitzel.Main
17
3.6.3
+ ${project.artifactId}-${project.version}
- 5.9.1
- 1.18.26
- 19.0.2.1
- 23.1.0
+ 19
+ 24.0.1
+ 5.9.2
1.18.26
+ 5.2.0
3.2.0
@@ -43,7 +43,7 @@
1.0.0.RC2
0.1.3
3.16.0
- 6.52.0
+ 6.55.0
2.11.0
4.7.2.0
4.7.3
@@ -52,10 +52,12 @@
UTF-8
${java.version}
${java.version}
+ ${java.version}
+
org.openjfx
javafx-controls
@@ -66,12 +68,18 @@
javafx-graphics
${javafx.version}
+
+ org.openjfx
+ javafx-fxml
+ ${javafx.version}
+
org.openjfx
javafx-web
${javafx.version}
+
org.projectlombok
lombok
@@ -79,6 +87,34 @@
provided
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ ${junit.version}
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-params
+ ${junit.version}
+ test
+
+
+
+
+ org.mockito
+ mockito-core
+ ${mockito.version}
+ test
+
+
+ org.mockito
+ mockito-junit-jupiter
+ ${mockito.version}
+ test
+
+
org.jetbrains
@@ -87,15 +123,10 @@
compile
-
- org.junit.jupiter
- junit-jupiter-engine
- ${junit.version}
- test
-
+ ${jar.filename}
org.apache.maven.plugins
@@ -288,13 +319,13 @@
-
org.apache.maven.plugins
maven-dependency-plugin
${maven.dependency.plugin}
+
copy-dependencies
package
@@ -303,98 +334,69 @@
${project.build.directory}/modules
+ runtime
false
false
true
+
+
+
+ copy
+ install
+
+ copy
+
+
+ ${project.build.directory}/modules
+
+
+ ${project.groupId}
+ ${project.artifactId}
+ ${project.version}
+ ${project.packaging}
+ ${project.build.finalName}.jar
+
+
+ true
+
+
-
-
- org.moditect
- moditect-maven-plugin
- ${moditect.maven.plugin}
-
-
- add-module-info-to-dependencies
- package
-
- ${project.build.directory}/modules
- true
-
-
-
-
- ${main.class}
- ${project.build.sourceDirectory}/module-info.java
-
-
-
- --ignore-missing-deps
-
-
-
- add-module-info
-
-
-
- create-runtime-image
- package
-
- create-runtime-image
-
-
-
- ${project.build.directory}/modules
-
-
- ${main.module}
-
-
- ${launcher}
- ${main.module}
-
- 2
- true
- APP_WITH_DEPENDENCIES
- true
- ${project.build.directory}/jlink-image
-
-
-
-
-
-
com.github.akman
jpackage-maven-plugin
${jpackage.maven.plugin}
+
+ ${appName}
+ IMAGE
+
+
+
+
+ javafx\..*
+
+
+
+
+
+ javafx.controls
+ javafx.graphics
+ javafx.fxml
+ javafx.web
+
+ ${main.class}
+ ${project.build.directory}/modules
+ ${jar.filename}.jar
+
- package
+ install
jpackage
-
- ${appName}
- IMAGE
- ${project.build.directory}/jlink-image
- ${main.module}/${main.class}
-
@@ -403,5 +405,4 @@
-
diff --git a/src/main/java/de/kneitzel/JavaFXApp.java b/src/main/java/de/kneitzel/JavaFXApp.java
index 2273df7..b477580 100644
--- a/src/main/java/de/kneitzel/JavaFXApp.java
+++ b/src/main/java/de/kneitzel/JavaFXApp.java
@@ -1,30 +1,30 @@
package de.kneitzel;
import javafx.application.Application;
-import javafx.event.ActionEvent;
-import javafx.event.EventHandler;
+import javafx.fxml.FXMLLoader;
+import javafx.scene.Parent;
import javafx.scene.Scene;
-import javafx.scene.control.Button;
-import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
+import java.io.IOException;
+
public class JavaFXApp extends Application {
@Override
public void start(Stage primaryStage) {
- primaryStage.setTitle("Hello World!");
- 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();
+ try {
+ primaryStage.setTitle("Hello World!");
+ FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("MainWindow.fxml"));
+ Parent root = fxmlLoader.load();
+ primaryStage.setScene(new Scene(root));
+ primaryStage.show();
+ } catch (Exception ex) {
+ System.out.println("Exception: " + ex.getMessage());
+ ex.printStackTrace();
+ }
}
public static void main(String[] args) {
- launch(args);
+ launch(args);
}
-
}
diff --git a/src/main/java/de/kneitzel/MainWindow.java b/src/main/java/de/kneitzel/MainWindow.java
new file mode 100644
index 0000000..4398a1b
--- /dev/null
+++ b/src/main/java/de/kneitzel/MainWindow.java
@@ -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) {
+
+ }
+}
diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java
deleted file mode 100644
index ca1dc44..0000000
--- a/src/main/java/module-info.java
+++ /dev/null
@@ -1,9 +0,0 @@
-module FXAppModule {
- requires javafx.base;
- requires javafx.graphics;
- requires javafx.controls;
- requires javafx.web;
-
- exports de.kneitzel;
- opens de.kneitzel;
-}
diff --git a/src/main/resources/de/kneitzel/MainWindow.fxml b/src/main/resources/de/kneitzel/MainWindow.fxml
new file mode 100644
index 0000000..07c63e6
--- /dev/null
+++ b/src/main/resources/de/kneitzel/MainWindow.fxml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+