1
1
JShell Plugin
2
2
=============
3
3
4
- > :warning : the plugin is not working properly with Java 12+, check this
5
- > [ section] ( #the-console-is-exited-once-started ) , although it works with
6
- > Java 9 to 11 (version 11 is LTS, use it! :point_left : ), check also how to deal with
7
- > different versions of Java [ here] ( #i-have-a-jdk-9-installation-but-my-default-jdk-is-the-jdk-8-or-below ) .
8
-
9
- This ** Gradle plugin** helps you to explore your code and dependencies in your gradle project
4
+ ** Gradle plugin** that helps you to explore your code and dependencies in your gradle project
10
5
with in [ jshell] ( https://docs.oracle.com/javase/9/jshell/introduction-jshell.htm ) ,
11
- the official Java REPL tool.
6
+ the official Java REPL tool (Java 9+) .
12
7
13
8
Hosted in the ** Gradle plugins** site: https://plugins.gradle.org/plugin/com.github.mrsarm.jshell.plugin
14
9
@@ -28,28 +23,11 @@ To use this plugin, add the following to your `build.gradle`:
28
23
29
24
``` groovy
30
25
plugins {
31
- id "com.github.mrsarm.jshell.plugin" version "1.0.0"
32
- }
33
- ```
34
-
35
- or in Gradle < 2.1:
36
-
37
- ``` groovy
38
- buildscript {
39
- repositories {
40
- maven {
41
- url "https://plugins.gradle.org/m2/"
42
- }
43
- }
44
- dependencies {
45
- classpath "gradle.plugin.com.github.mrsarm:jshell-plugin:1.0.0"
46
- }
26
+ id "com.github.mrsarm.jshell.plugin" version "1.1.0"
47
27
}
48
-
49
- apply plugin: "com.github.mrsarm.jshell.plugin"
50
28
```
51
29
52
- Task ` jshell ` is now enabled, which execute jshell with your classes and
30
+ Task ` jshell ` is now enabled, which execute the jshell with your classes and
53
31
dependencies after compiling your code.
54
32
55
33
You need to run the task ` jshell ` with the option ` --console plain ` .
@@ -103,7 +81,7 @@ at the beginning of the session.
103
81
You can override the startup script path with the project
104
82
property ` jshell.startup ` in the ` gradle.properties ` file,
105
83
or set the same property directly in the command line
106
- arguments:
84
+ arguments:
107
85
108
86
$ gradle --console plain jshell -Pjshell.startup=/path/to/run.jsh
109
87
@@ -280,7 +258,7 @@ the JDK installation, eg:
280
258
281
259
The export will live just whiting the session where is defined,
282
260
it does not change your system configuration globally, and calling
283
- to ` unset JAVA_HOME ` or opening a new session the export will
261
+ ` unset JAVA_HOME ` or opening a new session the export will
284
262
not have effect anymore.
285
263
286
264
You can even create an alias in your ` ~/.profile ` / ` ~/.bashrc `
@@ -311,6 +289,15 @@ weird characters in the console. Unfortunately, with the
311
289
current console support from Gradle, there is no
312
290
solution for this [ bug] ( https://github.com/mrsarm/jshell-plugin/issues/2 ) .
313
291
292
+ However, the JShell task can be invoked with the command ** rlwrap** from the
293
+ console to overcome the issue:
294
+
295
+ $ rlwrap ./gradlew --console plain jshell
296
+
297
+ ` rlwrap ` takes care of the autocompletion, and the arrow keys management.
298
+ Just remember to check you have installed it before invoking the JShell with
299
+ the command the first time.
300
+
314
301
315
302
System Requirements
316
303
-------------------
@@ -322,6 +309,9 @@ System Requirements
322
309
Build and Publish
323
310
-----------------
324
311
312
+ > :information_source : Only for developers that want to make
313
+ > changes to this source code.
314
+
325
315
To compile this plugin and build the .jar locally, checkout the
326
316
source code and execute:
327
317
@@ -351,7 +341,7 @@ buildscript {
351
341
}
352
342
}
353
343
dependencies {
354
- classpath "com.github.mrsarm:jshell-plugin:1.0 .0"
344
+ classpath "com.github.mrsarm:jshell-plugin:1.1 .0"
355
345
}
356
346
}
357
347
@@ -366,11 +356,11 @@ This is a fork of the project https://github.com/bitterfox/jshell-gradle-plugin
366
356
I forked it because the original project is not receiving patches
367
357
and this version solves some issues and adds the following features:
368
358
369
- - It works with ** multi-module projects**
359
+ - It works with ** multi-module projects** .
370
360
- There is no need to set the env variable ` JAVA_OPTS ` with a bunch
371
- of arguments _ "--add-exports jdk.jshell/jdk.intern..."_
372
- - It allows to run at the beginning of the session a _ .jsh_ startup script
373
- - Special support to the ** Spring Framework**
361
+ of arguments _ "--add-exports jdk.jshell/jdk.intern..."_ .
362
+ - It allows to run at the beginning of the session a _ .jsh_ startup script.
363
+ - Special support to the ** Spring Framework** .
374
364
375
365
** Project** : https://github.com/mrsarm/jshell-plugin
376
366
@@ -382,4 +372,4 @@ and this version solves some issues and adds the following features:
382
372
383
373
### License
384
374
385
- - (2020) [ Apache Software License 2.0] ( https://www.apache.org/licenses/LICENSE-2.0 ) .
375
+ - (2020-2021 ) [ Apache Software License 2.0] ( https://www.apache.org/licenses/LICENSE-2.0 ) .
0 commit comments