From 79ac535e27069a9123bc97f7ac2454d755af9492 Mon Sep 17 00:00:00 2001 From: jbock Date: Tue, 12 Nov 2024 13:23:57 +0100 Subject: [PATCH] simplify bash script --- .gitignore | 2 -- README.md | 3 +-- cp | 2 ++ create_launcher_script | 5 ----- get_module_path | 5 ++--- 5 files changed, 5 insertions(+), 12 deletions(-) create mode 100755 cp delete mode 100755 create_launcher_script diff --git a/.gitignore b/.gitignore index 8667d70..3223258 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,3 @@ *.iml *~ /out - -/cp diff --git a/README.md b/README.md index 1e23647..0b05e3a 100644 --- a/README.md +++ b/README.md @@ -42,8 +42,7 @@ requires net.jbock; ````sh ./mvnw clean package -jpackage --name cp --type app-image --module-path `./get_module_path` --module jbock.maven.example/net.jbock.cp.CopyFile --dest target/out -./create_launcher_script >cp && chmod +x cp +./mvnw dependency:copy-dependencies -DincludeScope=runtime ./cp --help ./cp 1 -s2 2 ```` diff --git a/cp b/cp new file mode 100755 index 0000000..7360ca6 --- /dev/null +++ b/cp @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +java --module-path $(./get_module_path) --module jbock.maven.example/net.jbock.cp.CopyFile $@ diff --git a/create_launcher_script b/create_launcher_script deleted file mode 100755 index 9027513..0000000 --- a/create_launcher_script +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -echo '#!/usr/bin/env bash' -EXECUTABLE=`find target/out -type f -name cp` -echo "$EXECUTABLE" '$@' - diff --git a/get_module_path b/get_module_path index b602f77..6a72108 100755 --- a/get_module_path +++ b/get_module_path @@ -5,8 +5,7 @@ join_tokens () { } JARS=() -for JAR in `find target -name "*.jar"`; do +for JAR in target/*.jar target/dependency/*.jar; do JARS+=("${JAR}") done -MODULE_PATH=`join_tokens ${JARS[@]}` -echo "$MODULE_PATH" +join_tokens ${JARS[@]}