11JShell Plugin
22=============
33
4- This Gradle plugin helps you to explore your code and dependencies in your gradle project
4+ This ** Gradle plugin** helps you to explore your code and dependencies in your gradle project
55with in [ jshell] ( https://docs.oracle.com/javase/9/jshell/introduction-jshell.htm ) ,
66the official Java REPL tool.
77
8- Hosted on (NOT published yet): https://plugins.gradle.org/plugin/com.github.mrsarm.jshell.plugin
8+ Hosted on _ (NOT published yet)_ : https://plugins.gradle.org/plugin/com.github.mrsarm.jshell.plugin
9+
10+ - [ Getting started] ( #getting-started )
11+ - [ Startup options] ( #startup-options )
12+ - [ Troubleshooting] ( #troubleshooting )
13+ - [ System Requirements] ( #system-requirements )
14+ - [ Build and Publish] ( #build-an-publish )
15+ - [ About] ( #about )
916
1017
1118Getting started
@@ -19,7 +26,7 @@ plugins {
1926}
2027```
2128
22- or for Gradle < 2.1:
29+ or in Gradle < 2.1:
2330
2431``` groovy
2532buildscript {
@@ -44,14 +51,54 @@ Following is an example:
4451
4552 $ gradle --no-daemon --console plain jshell
4653
54+ Startup options
55+ ---------------
56+
57+ The shell console starts with the options
58+ ` --startup DEFAULT --startup PRINTING ` so always
59+ the following imports and functions are available:
60+
61+ - java.io
62+ - java.math
63+ - java.net
64+ - java.nio.file
65+ - java.util
66+ - java.util.concurrent
67+ - java.util.function
68+ - java.util.prefs
69+ - java.util.regex
70+ - java.util.stream
71+ - print (alias of ` System.out.print ` )
72+ - println (alias of ` System.out.println ` )
73+
74+ If the plugin founds at the root of the project a
75+ [ JShell Script] ( https://docs.oracle.com/javase/9/jshell/scripts.htm )
76+ named ` startup.jsh ` , it will append to the JShell session
77+ the argument ` --startup startup.jsh ` , executing
78+ at the beginning all the instruction in the script,
79+ so you can add there all the imports, object definitions
80+ or any Java instruction that you want to execute
81+ at the begging of the session. You can override
82+ the startup script path with the project property
83+ ` jshell.startup ` in the ` gradle.properties ` file,
84+ or set the same property in the command line
85+ arguments, like:
86+
87+ $ gradle --no-daemon --console plain jshell -Pjshell.startup=/path/to/run.jsh
88+
89+
90+ Troubleshooting
91+ ---------------
92+
4793If you see this warning and the jshell console does not detect your classes:
4894
4995> : jshell task : classes not found, be sure to compile the project first
5096
5197Means the ` classes ` task needed to compile your project before launch ` jshell `
52- does not exist, just append the task needed to compile the project,
53- some times is the same ` classes ` task but is not detected in multi-modules
54- projects, so you need to add it explicitly in the Gradle command:
98+ does not exist, just append in the command line the task needed to compile
99+ the project, some times is the same ` classes ` task but is not detected
100+ in multi-modules projects, so you need to add it explicitly in the
101+ Gradle command:
55102
56103 $ gradle --no-daemon --console plain classes jshell
57104
@@ -63,8 +110,8 @@ System Requirements
63110 * Gradle
64111
65112
66- Build & Publish
67- ---------------
113+ Build and Publish
114+ -----------------
68115
69116Compile and build the .jar locally with:
70117
@@ -74,6 +121,7 @@ Publish to your local Maven repo:
74121
75122 $ ./gradlew publishToMavenLocal
76123
124+
77125About
78126-----
79127
@@ -84,14 +132,17 @@ and this version solve some issues and adds the following features:
84132 - It works with ** multi-module projects**
85133 - There is no need to set the env variable ` JAVA_OPTS ` with a bunch of
86134 of arguments _ "--add-exports jdk.jshell/jdk.intern..."_
87- - _ Coming soon_ : add special support to the ** Spring Framework**
135+ - It allows to run at the beginning of the session a _ .jsh_ startup script
136+ - _ Coming soon_ : special support to the ** Spring Framework**
88137
89138Project: https://github.com/mrsarm/jshell-plugin
90139
91- Authors:
140+ ### Authors
92141
93142 - Mariano Ruiz < mrsarm@gmail.com >
94143 - https://github.com/bitterfox
95144 (original [ project] ( https://github.com/bitterfox/jshell-gradle-plugin ) )
96145
97- License: (2020) [ Apache Software License 2.0] ( https://www.apache.org/licenses/LICENSE-2.0 ) .
146+ ### License
147+
148+ - (2020) [ Apache Software License 2.0] ( https://www.apache.org/licenses/LICENSE-2.0 ) .
0 commit comments