Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cli] Launch script fails if run via "bash pmd" #4640

Merged
merged 2 commits into from Oct 20, 2023

Conversation

shai-bennathan
Copy link
Contributor

@shai-bennathan shai-bennathan commented Aug 7, 2023

If run.sh is launched via 'bin/bash run.sh', when run.sh is not in the local directory (i.e., accessed via path env var), it thinks it runs in the local directory.
This change makes sure that all cases are covered.
Tested on local Ubuntu 22.04 and similar Docker container running on Jenkins.

Currently if run.sh is launched via 'bin/bash run.sh', when run.sh is not in the local directory (i.e., accessed via path env var) it thinks it runs in the local directory.
This change makes sure that all cases are covered.
Tested on local Ubuntu 22.04.
Copy link
Member

@jsotuyod jsotuyod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution. This is very insightful.

pmd-dist/src/main/resources/scripts/pmd Outdated Show resolved Hide resolved
Co-authored-by: Juan Martín Sotuyo Dodero <juansotuyo@gmail.com>
@adangel
Copy link
Member

adangel commented Aug 7, 2023

For my own understanding, this is the problem:

PMD_HOME=/home/andreas/PMD/binaries/pmd-bin-7.0.0-rc3
PATH=${PMD_HOME}/bin:$PATH
bash pmd

/home/andreas/PMD/binaries/pmd-bin-7.0.0-rc3/bin/pmd: line 62: pushd: ./../lib: No such file or directory
/home/andreas/PMD/binaries/pmd-bin-7.0.0-rc3/bin/pmd: line 64: popd: directory stack empty
/home/andreas/PMD/binaries/pmd-bin-7.0.0-rc3/bin/pmd: line 84: pushd: ./../conf: No such file or directory
/home/andreas/PMD/binaries/pmd-bin-7.0.0-rc3/bin/pmd: line 86: popd: directory stack empty
Error: Could not find or load main class net.sourceforge.pmd.cli.PmdCli
Caused by: java.lang.ClassNotFoundException: net.sourceforge.pmd.cli.PmdCli

Ok, we need the same fix in line 77 (function "set_conf_dir")...

Thanks for the contribution!

@adangel adangel added the a:bug PMD crashes or fails to analyse a file. label Aug 7, 2023
@adangel adangel changed the title Issue: Launch failure via bin/bash [cli] Launch script fails if run via "bash pmd" Aug 7, 2023
jsotuyod added a commit that referenced this pull request Oct 20, 2023
@jsotuyod jsotuyod merged commit 56ae02a into pmd:master Oct 20, 2023
@adangel adangel added this to the 7.0.0 milestone Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:bug PMD crashes or fails to analyse a file.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[cli] Launch fails for "bash pmd"
3 participants