Created
October 26, 2023 15:44
-
-
Save dehidehidehi/ad34b997ba1b1470157ce4cc72b80547 to your computer and use it in GitHub Desktop.
JShell bootstrap code for loading full application classpath with Maven.
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
#!/bin/bash | |
# Compile if needed. | |
#mvn package -DskipTests | |
# Remove Maven logs and trim leading and trailing whitespaces with xargs. | |
cp=$(mvn -q dependency:build-classpath \ | |
-DincludeTypes=jar \ | |
-Dmdep.outputFile=/dev/stderr \ | |
2>&1 >/dev/null | grep -v -E '(DEBUG|INFO|WARNING)' | xargs) | |
export CLASSPATH=$cp":target/classes" | |
# Specify Java code to run at start of JShell. | |
startUpJavaBootstrap="./bootstrap.jsh" | |
# Start JShell with full reflexion capabilities. | |
jshell \ | |
-J--add-opens=java.base/java.lang=ALL-UNNAMED \ | |
-J--illegal-access=permit \ | |
-start DEFAULT \ | |
-start PRINTING \ | |
-start $startUpJavaBootstrap |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
public static ConfigurableApplicationContext main() {
return SpringApplication.run(DemoApplication.class);
}