Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to JLine 3.x to avoid Jansi 1.x dependency/usage #19510

Merged
merged 1 commit into from
Aug 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,10 @@
<exclude>org.jboss.resteasy:resteasy-context-propagation</exclude>
<exclude>com.google.android:annotations</exclude>
<exclude>org.codehaus.mojo:animal-sniffer-annotations</exclude>
<!-- JLine 2.x (EOLed) version shouldn't be pulled in,
to prevent version compatibility issues with the
Jansi library shipped in Maven -->
<exclude>jline:jline</exclude>
</excludes>
<includes>
<!-- this is for REST Assured -->
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -17,7 +15,4 @@ public Prompter() throws IOException {
super();
}

public Prompter(InputStream in, OutputStream out) throws IOException {
super(in, out);
}
}
4 changes: 4 additions & 0 deletions independent-projects/arc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@
<exclude>org.slf4j:slf4j-jdk14</exclude>
<exclude>org.slf4j:slf4j-log4j12</exclude>
<exclude>org.slf4j:slf4j-log4j13</exclude>
<!-- JLine 2.x (EOLed) version shouldn't be pulled in,
to prevent version compatibility issues with the
Jansi library shipped in Maven -->
<exclude>jline:jline</exclude>
</excludes>
</bannedDependencies>
</rules>
Expand Down
4 changes: 4 additions & 0 deletions independent-projects/bootstrap/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@
<exclude>org.slf4j:slf4j-jdk14</exclude>
<exclude>org.slf4j:slf4j-log4j12</exclude>
<exclude>org.slf4j:slf4j-log4j13</exclude>
<!-- JLine 2.x (EOLed) version shouldn't be pulled in,
to prevent version compatibility issues with the
Jansi library shipped in Maven -->
<exclude>jline:jline</exclude>
</excludes>
</bannedDependencies>
</rules>
Expand Down
4 changes: 4 additions & 0 deletions independent-projects/qute/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@
<exclude>org.slf4j:slf4j-jdk14</exclude>
<exclude>org.slf4j:slf4j-log4j12</exclude>
<exclude>org.slf4j:slf4j-log4j13</exclude>
<!-- JLine 2.x (EOLed) version shouldn't be pulled in,
to prevent version compatibility issues with the
Jansi library shipped in Maven -->
<exclude>jline:jline</exclude>
</excludes>
</bannedDependencies>
</rules>
Expand Down
4 changes: 4 additions & 0 deletions independent-projects/resteasy-reactive/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,10 @@
<exclude>org.slf4j:slf4j-jdk14</exclude>
<exclude>org.slf4j:slf4j-log4j12</exclude>
<exclude>org.slf4j:slf4j-log4j13</exclude>
<!-- JLine 2.x (EOLed) version shouldn't be pulled in,
to prevent version compatibility issues with the
Jansi library shipped in Maven -->
<exclude>jline:jline</exclude>
</excludes>
</bannedDependencies>
</rules>
Expand Down
2 changes: 1 addition & 1 deletion independent-projects/tools/devtools-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</dependency>
<!-- user prompt -->
<dependency>
<groupId>jline</groupId>
<groupId>org.jline</groupId>
<artifactId>jline</artifactId>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -14,22 +15,15 @@
*/
public class Prompter {

private final ConsoleReader console;
private final LineReader lineReader;

public Prompter() throws IOException {
gastaldi marked this conversation as resolved.
Show resolved Hide resolved
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 {
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand Down
8 changes: 6 additions & 2 deletions independent-projects/tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<scala-plugin.version>4.4.0</scala-plugin.version>

<!-- Versions -->
<jline.version>2.14.6</jline.version>
<jline.version>3.20.0</jline.version>
<assertj.version>3.20.2</assertj.version>
<jackson.version>2.12.4</jackson.version>
<jakarta.enterprise.cdi-api.version>2.0.2</jakarta.enterprise.cdi-api.version>
Expand Down Expand Up @@ -130,7 +130,7 @@
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>jline</groupId>
<groupId>org.jline</groupId>
<artifactId>jline</artifactId>
<version>${jline.version}</version>
</dependency>
Expand Down Expand Up @@ -309,6 +309,10 @@
<exclude>org.slf4j:slf4j-jdk14</exclude>
<exclude>org.slf4j:slf4j-log4j12</exclude>
<exclude>org.slf4j:slf4j-log4j13</exclude>
<!-- JLine 2.x (EOLed) version shouldn't be pulled in,
to prevent version compatibility issues with the
Jansi library shipped in Maven -->
<exclude>jline:jline</exclude>
</excludes>
</bannedDependencies>
</rules>
Expand Down