Last active
September 18, 2024 12:20
-
-
Save jianwu/9b36a3c9b47edd9c2304ccbf9ace081b to your computer and use it in GitHub Desktop.
mshell: to run jshell for a maven project with all the dependancies injected.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run this script from the maven module directory to start a jshell with | |
# all dependent class paths injected. | |
# Please never run it on the parent maven project directory. | |
# It depends on java9 or above | |
if [ ! -d "target" ]; then | |
echo "Please run it under a module directory. And make sure it's not parent module directory. And make a maven install first" | |
exit | |
fi | |
mvn dependency:build-classpath -DincludeTypes=jar -Dmdep.outputFile=.cp.tmp | |
jshell --class-path `cat .cp.tmp`:target/classes "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment