Skip to content

Instantly share code, notes, and snippets.

@jianwu
Last active October 27, 2021 12:50
Embed
What would you like to do?
mshell: to run jshell for a maven project with all the dependancies injected.
# 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