From 44e5088cc4e86791bcb3dbc6d14487afbb9f0a8f Mon Sep 17 00:00:00 2001
From: arnaudlabourel <arnaud.labourel@univ-amu.fr>
Date: Tue, 3 Oct 2023 16:28:22 +0200
Subject: [PATCH] updated project with shadow

---
 build.gradle                                  | 24 +++++++++----------
 src/main/java/module-info.java                |  5 ++++
 src/main/java/sample/Main.java                |  7 ++++++
 .../sample/{App.java => MyApplication.java}   |  3 +--
 4 files changed, 25 insertions(+), 14 deletions(-)
 create mode 100644 src/main/java/module-info.java
 create mode 100644 src/main/java/sample/Main.java
 rename src/main/java/sample/{App.java => MyApplication.java} (93%)

diff --git a/build.gradle b/build.gradle
index 3f68e94..1ba2119 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,4 +1,5 @@
 plugins {
+    id 'com.github.johnrengelman.shadow' version '8.1.1'
     id 'java'
     id 'application'
     id 'checkstyle'
@@ -6,15 +7,13 @@ plugins {
     id 'pmd'
     id "com.github.spotbugs" version "5.0.13"
     id 'org.openjfx.javafxplugin' version '0.1.0'
-    id 'org.beryx.jlink' version '2.26.0'
 }
 
 group 'fr.univ_amu'
-version '1.0-SNAPSHOT'
 
 javafx {
     version = "21"
-    modules = [ 'javafx.controls', 'javafx.fxml' ]
+    modules = [ 'javafx.controls']
 }
 
 checkstyle {
@@ -37,6 +36,7 @@ dependencies {
 test {
     finalizedBy jacocoTestReport // report is always generated after tests run
 }
+
 jacocoTestReport {
     dependsOn test // tests are required to run before generating the report
 }
@@ -46,15 +46,7 @@ test {
 }
 
 application {
-    mainClass = 'sample.App'
-}
-
-tasks.named('jar') {
-    manifest {
-        attributes('Implementation-Title': project.name,
-                'Implementation-Version': project.version,
-                'main-Class': application.mainClass )
-    }
+    mainClass = 'sample.Main'
 }
 
 spotbugs {
@@ -74,6 +66,14 @@ spotbugsMain {
     }
 }
 
+jar {
+    manifest {
+        attributes("Implementation-Title": project.name,
+                "Implementation-Version": version,
+                "Main-Class": application.mainClass)
+    }
+}
+
 spotbugsTest {
     reports {
         html {
diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java
new file mode 100644
index 0000000..fc8b32e
--- /dev/null
+++ b/src/main/java/module-info.java
@@ -0,0 +1,5 @@
+module sample {
+  requires javafx.controls;
+
+  exports sample;
+}
\ No newline at end of file
diff --git a/src/main/java/sample/Main.java b/src/main/java/sample/Main.java
new file mode 100644
index 0000000..9971769
--- /dev/null
+++ b/src/main/java/sample/Main.java
@@ -0,0 +1,7 @@
+package sample;
+
+public class Main {
+  public static void main(String[] args){
+    MyApplication.main(args);
+  }
+}
diff --git a/src/main/java/sample/App.java b/src/main/java/sample/MyApplication.java
similarity index 93%
rename from src/main/java/sample/App.java
rename to src/main/java/sample/MyApplication.java
index 1bcd9be..6e613a1 100644
--- a/src/main/java/sample/App.java
+++ b/src/main/java/sample/MyApplication.java
@@ -1,5 +1,4 @@
 package sample;
-import javafx.application.Application;
 import javafx.scene.Group;
 import javafx.scene.Scene;
 import javafx.scene.image.Image;
@@ -7,7 +6,7 @@ import javafx.scene.image.ImageView;
 import javafx.stage.Stage;
 
 
-public class App extends Application {
+public class MyApplication extends javafx.application.Application {
 
   @Override
   public void start(Stage stage) {
-- 
GitLab