From b75ca07e8e2abaf4448cbf91cfff2ca3e7df44ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Mon, 15 Oct 2018 04:14:21 -0300 Subject: [PATCH 1/3] Allow symlinking the run script --- pmd-dist/src/main/scripts/run.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pmd-dist/src/main/scripts/run.sh b/pmd-dist/src/main/scripts/run.sh index 9a5ce0d3e0..dfda65642c 100755 --- a/pmd-dist/src/main/scripts/run.sh +++ b/pmd-dist/src/main/scripts/run.sh @@ -61,7 +61,9 @@ java_heapsize_settings() { set_lib_dir() { if [ -z ${LIB_DIR} ]; then - local script_dir=$(dirname "${0}") + # Allow for symlinks to this script + local script_real_loc=$(realpath "$0") + local script_dir=$(dirname "${script_real_loc}") local cwd="${PWD}" cd "${script_dir}/../lib" From 1cbae7f1e99df5be6b31644c31793b19d361eee0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Mon, 15 Oct 2018 04:15:08 -0300 Subject: [PATCH 2/3] Update changelog, refs #1272 --- docs/pages/release_notes.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index bb034cc5b5..8a924aee6b 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -23,6 +23,8 @@ as comments are recognized as such and ignored. ### Fixed Issues +* all + * [#1272](https://github.com/pmd/pmd/issues/1272): \[core] Could not find or load main class when using symlinked run.sh * java * [#1330](https://github.com/pmd/pmd/issues/1330): \[java] PMD crashes with java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/xml/ws/Service * java-bestpractices From 5b736feefd2dd54e008b518a4269078dc73dd634 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Mon, 15 Oct 2018 04:54:18 -0300 Subject: [PATCH 3/3] Don't depend on realpath being installed --- pmd-dist/src/main/scripts/run.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pmd-dist/src/main/scripts/run.sh b/pmd-dist/src/main/scripts/run.sh index dfda65642c..79e4ef609e 100755 --- a/pmd-dist/src/main/scripts/run.sh +++ b/pmd-dist/src/main/scripts/run.sh @@ -62,7 +62,11 @@ java_heapsize_settings() { set_lib_dir() { if [ -z ${LIB_DIR} ]; then # Allow for symlinks to this script - local script_real_loc=$(realpath "$0") + if [ -L $0 ]; then + local script_real_loc=$(readlink "$0") + else + local script_real_loc=$0 + fi local script_dir=$(dirname "${script_real_loc}") local cwd="${PWD}"