Skip to content

Commit

Permalink
Version 1.1.0: Upgrade Gradle conf removing support to old versions a…
Browse files Browse the repository at this point in the history
…nd typo fixes (#7)

Upgrade building conf, README notes and Bump → 1.1.0

- Remove support to old Gradle versions where it's unlikely Java 9+ is used
- Use ~compile~ → implementation (compile is deprecated)
- Remove unused and deprecated JCenter repo
- Upgrade publishing repo plugin
- Bump → 1.1.0
- Remove note about the plugin not working with Java 12+ fixed in #6
- Typo fixes
- Add trick to overcome autocompletion in the README
  • Loading branch information
mrsarm authored Jul 15, 2021
1 parent b6aebbb commit 2a6a6c2
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 41 deletions.
58 changes: 24 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
JShell Plugin
=============

> :warning: the plugin is not working properly with Java 12+, check this
> [section](#the-console-is-exited-once-started), although it works with
> Java 9 to 11 (version 11 is LTS, use it! :point_left:), check also how to deal with
> different versions of Java [here](#i-have-a-jdk-9-installation-but-my-default-jdk-is-the-jdk-8-or-below).
This **Gradle plugin** helps you to explore your code and dependencies in your gradle project
**Gradle plugin** that helps you to explore your code and dependencies in your gradle project
with in [jshell](https://docs.oracle.com/javase/9/jshell/introduction-jshell.htm),
the official Java REPL tool.
the official Java REPL tool (Java 9+).

Hosted in the **Gradle plugins** site: https://plugins.gradle.org/plugin/com.github.mrsarm.jshell.plugin

Expand All @@ -28,28 +23,11 @@ To use this plugin, add the following to your `build.gradle`:

```groovy
plugins {
id "com.github.mrsarm.jshell.plugin" version "1.0.0"
}
```

or in Gradle < 2.1:

```groovy
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "gradle.plugin.com.github.mrsarm:jshell-plugin:1.0.0"
}
id "com.github.mrsarm.jshell.plugin" version "1.1.0"
}
apply plugin: "com.github.mrsarm.jshell.plugin"
```

Task `jshell` is now enabled, which execute jshell with your classes and
Task `jshell` is now enabled, which execute the jshell with your classes and
dependencies after compiling your code.

You need to run the task `jshell` with the option `--console plain`.
Expand Down Expand Up @@ -103,7 +81,7 @@ at the beginning of the session.
You can override the startup script path with the project
property `jshell.startup` in the `gradle.properties` file,
or set the same property directly in the command line
arguments:
arguments:

$ gradle --console plain jshell -Pjshell.startup=/path/to/run.jsh

Expand Down Expand Up @@ -280,7 +258,7 @@ the JDK installation, eg:

The export will live just whiting the session where is defined,
it does not change your system configuration globally, and calling
to `unset JAVA_HOME` or opening a new session the export will
`unset JAVA_HOME` or opening a new session the export will
not have effect anymore.

You can even create an alias in your `~/.profile` / `~/.bashrc`
Expand Down Expand Up @@ -311,6 +289,15 @@ weird characters in the console. Unfortunately, with the
current console support from Gradle, there is no
solution for this [bug](https://github.com/mrsarm/jshell-plugin/issues/2).

However, the JShell task can be invoked with the command **rlwrap** from the
console to overcome the issue:

$ rlwrap ./gradlew --console plain jshell

`rlwrap` takes care of the autocompletion, and the arrow keys management.
Just remember to check you have installed it before invoking the JShell with
the command the first time.


System Requirements
-------------------
Expand All @@ -322,6 +309,9 @@ System Requirements
Build and Publish
-----------------

> :information_source: Only for developers that want to make
> changes to this source code.
To compile this plugin and build the .jar locally, checkout the
source code and execute:

Expand Down Expand Up @@ -351,7 +341,7 @@ buildscript {
}
}
dependencies {
classpath "com.github.mrsarm:jshell-plugin:1.0.0"
classpath "com.github.mrsarm:jshell-plugin:1.1.0"
}
}
Expand All @@ -366,11 +356,11 @@ This is a fork of the project https://github.com/bitterfox/jshell-gradle-plugin
I forked it because the original project is not receiving patches
and this version solves some issues and adds the following features:

- It works with **multi-module projects**
- It works with **multi-module projects**.
- There is no need to set the env variable `JAVA_OPTS` with a bunch
of arguments _"--add-exports jdk.jshell/jdk.intern..."_
- It allows to run at the beginning of the session a _.jsh_ startup script
- Special support to the **Spring Framework**
of arguments _"--add-exports jdk.jshell/jdk.intern..."_.
- It allows to run at the beginning of the session a _.jsh_ startup script.
- Special support to the **Spring Framework**.

**Project**: https://github.com/mrsarm/jshell-plugin

Expand All @@ -382,4 +372,4 @@ and this version solves some issues and adds the following features:

### License

- (2020) [Apache Software License 2.0](https://www.apache.org/licenses/LICENSE-2.0).
- (2020-2021) [Apache Software License 2.0](https://www.apache.org/licenses/LICENSE-2.0).
10 changes: 4 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
plugins {
id 'com.gradle.plugin-publish' version '0.11.0'
id 'com.gradle.plugin-publish' version '0.15.0'
id 'maven-publish'
id 'groovy'
id 'java-library'
}

group 'com.github.mrsarm'
version '1.0.0'
version '1.1.0'

sourceCompatibility = 9
targetCompatibility = 9

repositories {
mavenCentral()
jcenter()
}

dependencies {
compile gradleApi()
compile localGroovy()
implementation gradleApi()
implementation localGroovy()
}
jar.baseName = 'jshell-plugin'

tasks.withType(GroovyCompile) {
options.fork = false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020 the original author or authors.
* Copyright 2020-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down

0 comments on commit 2a6a6c2

Please sign in to comment.