Skip to content
Maven Plugin for the Java Shell Tool (JShell)
Java
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/main/java Add options support May 27, 2019
.gitignore add runtime classpath elements Mar 9, 2018
LICENSE add testclasspath Apr 3, 2018
README.adoc Add options support May 27, 2019
pom.xml [maven-release-plugin] prepare for next development iteration May 27, 2019

README.adoc

jshell-maven-plugin

Maven Plugin for the Java Shell Tool ( JShell )

Usage

$mvn com.github.johnpoth:jshell-maven-plugin:1.1:run
|  Welcome to JShell -- Version 10
|  For an introduction type: /help intro
jshell>

Now you can start using your project’s runtime classpath:

jshell> var foo = new org.apache.camel.component.beanclass.ClassComponent()
foo ==> org.apache.camel.component.beanclass.ClassComponent@4d1b0d2a
jshell>

To you use your project’s test classpath, add -DtestClasspath to the command.

Options

Name

Description

Default value

class-path

Explicitly set JShell’s class path

module-path

Set JShell’s module path

add-modules

Add modules from JShell’s module path

add-exports

Explicitly add exports

scripts

Add startup scripts to JShell ',' delimited

useProjectClasspath

Use project class path in JShell

True

options

Add other options to JShell. See docs

Reminder: plugin parameters when passed through the command line should be prefixed with 'jshell.' e.g: mvn com.github.johnpoth:jshell-maven-plugin:1.2:run -Djshell.scripts="script0,script1"

Adding to pom.xml

To use the plugin’s shortened prefix jshell, declare the plugin in your pom.xml

<pluginManagement>
  <plugins>
    <plugin>
      <groupId>com.github.johnpoth</groupId>
      <artifactId>jshell-maven-plugin</artifactId>
      <version>1.1</version>
    </plugin>
  </plugins>
</pluginManagement>

And now you’ll be able to run it by typing mvn jshell:run

$mvn jshell:run
|  Welcome to JShell -- Version 10
|  For an introduction type: /help intro
jshell>

Works on Java 9, 10 and 11+ Enjoy!

You can’t perform that action at this time.