diff --git a/build-parent/pom.xml b/build-parent/pom.xml index d434c7cb8fc0a..aa4e7c46ab658 100644 --- a/build-parent/pom.xml +++ b/build-parent/pom.xml @@ -503,6 +503,10 @@ org.jboss.resteasy:resteasy-context-propagation com.google.android:annotations org.codehaus.mojo:animal-sniffer-annotations + + jline:jline diff --git a/devtools/maven/src/main/java/io/quarkus/maven/components/Prompter.java b/devtools/maven/src/main/java/io/quarkus/maven/components/Prompter.java index f83db7c27609e..793fb32c3552b 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/components/Prompter.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/components/Prompter.java @@ -1,8 +1,6 @@ package io.quarkus.maven.components; import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; import org.codehaus.plexus.component.annotations.Component; @@ -17,7 +15,4 @@ public Prompter() throws IOException { super(); } - public Prompter(InputStream in, OutputStream out) throws IOException { - super(in, out); - } } diff --git a/independent-projects/arc/pom.xml b/independent-projects/arc/pom.xml index 4ac3b17b0ea46..64b4303472564 100644 --- a/independent-projects/arc/pom.xml +++ b/independent-projects/arc/pom.xml @@ -245,6 +245,10 @@ org.slf4j:slf4j-jdk14 org.slf4j:slf4j-log4j12 org.slf4j:slf4j-log4j13 + + jline:jline diff --git a/independent-projects/bootstrap/pom.xml b/independent-projects/bootstrap/pom.xml index b2c3c6dd94c85..8fae147cb9081 100644 --- a/independent-projects/bootstrap/pom.xml +++ b/independent-projects/bootstrap/pom.xml @@ -123,6 +123,10 @@ org.slf4j:slf4j-jdk14 org.slf4j:slf4j-log4j12 org.slf4j:slf4j-log4j13 + + jline:jline diff --git a/independent-projects/qute/pom.xml b/independent-projects/qute/pom.xml index 4dbe21e14ad3f..ea14cf36cd96f 100644 --- a/independent-projects/qute/pom.xml +++ b/independent-projects/qute/pom.xml @@ -173,6 +173,10 @@ org.slf4j:slf4j-jdk14 org.slf4j:slf4j-log4j12 org.slf4j:slf4j-log4j13 + + jline:jline diff --git a/independent-projects/resteasy-reactive/pom.xml b/independent-projects/resteasy-reactive/pom.xml index 3067ad3b99707..ef00959b88d2d 100644 --- a/independent-projects/resteasy-reactive/pom.xml +++ b/independent-projects/resteasy-reactive/pom.xml @@ -364,6 +364,10 @@ org.slf4j:slf4j-jdk14 org.slf4j:slf4j-log4j12 org.slf4j:slf4j-log4j13 + + jline:jline diff --git a/independent-projects/tools/devtools-common/pom.xml b/independent-projects/tools/devtools-common/pom.xml index d7f8dec9a1b64..44f78ef114811 100644 --- a/independent-projects/tools/devtools-common/pom.xml +++ b/independent-projects/tools/devtools-common/pom.xml @@ -44,7 +44,7 @@ - jline + org.jline jline diff --git a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/utils/Prompter.java b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/utils/Prompter.java index b21dbf5eb2301..530db55b12027 100644 --- a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/utils/Prompter.java +++ b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/utils/Prompter.java @@ -1,11 +1,12 @@ package io.quarkus.devtools.utils; import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; import java.util.Objects; -import jline.console.ConsoleReader; import org.apache.commons.lang3.StringUtils; +import org.jline.reader.LineReader; +import org.jline.reader.LineReaderBuilder; +import org.jline.terminal.Terminal; +import org.jline.terminal.TerminalBuilder; /** * Prompt implementation. @@ -14,22 +15,15 @@ */ public class Prompter { - private final ConsoleReader console; + private final LineReader lineReader; public Prompter() throws IOException { - this.console = new ConsoleReader(); - console.setHistoryEnabled(false); - console.setExpandEvents(false); - } - - public Prompter(InputStream in, OutputStream out) throws IOException { - this.console = new ConsoleReader(in, out); - console.setHistoryEnabled(false); - console.setExpandEvents(false); - } - - public ConsoleReader getConsole() { - return console; + // we set dumb to "true" only to prevent any warning when a proper terminal cannot be detected. + // If a proper terminal is detected by JLine then that terminal will be used and setting dumb=true + // won't force a dumb terminal. + // (https://github.com/jline/jline3/issues/291) + final Terminal terminal = TerminalBuilder.builder().dumb(true).build(); + this.lineReader = LineReaderBuilder.builder().terminal(terminal).build(); } public String prompt(final String message, final Character mask) throws IOException { @@ -38,7 +32,7 @@ public String prompt(final String message, final Character mask) throws IOExcept final String prompt = String.format("%s: ", message); String value; do { - value = console.readLine(prompt, mask); + value = lineReader.readLine(prompt, mask); } while (StringUtils.isBlank(value)); return value; } @@ -53,7 +47,7 @@ public String promptWithDefaultValue(final String message, final String defaultV Objects.requireNonNull(defaultValue); final String prompt = String.format("%s [%s]: ", message, defaultValue); - String value = console.readLine(prompt); + String value = lineReader.readLine(prompt); if (StringUtils.isBlank(value)) { return defaultValue; } diff --git a/independent-projects/tools/pom.xml b/independent-projects/tools/pom.xml index 916222c0122bf..74412aea6d625 100644 --- a/independent-projects/tools/pom.xml +++ b/independent-projects/tools/pom.xml @@ -38,7 +38,7 @@ 4.4.0 - 2.14.6 + 3.20.0 3.20.2 2.12.4 2.0.2 @@ -130,7 +130,7 @@ ${project.version} - jline + org.jline jline ${jline.version} @@ -309,6 +309,10 @@ org.slf4j:slf4j-jdk14 org.slf4j:slf4j-log4j12 org.slf4j:slf4j-log4j13 + + jline:jline