因此,我只是在我的IDE中设置了一个Jline3项目来测试它是否有效。
它只有一个类,我是从这里复制的:https://github.com/jline/jline3/blob/master/builtins/src/test/java/org/jline/example/Example.java
Jline3提供了一些我实际上想要使用的很好的特性,尽管文档非常糟糕。存在的问题;它不能在窗口上工作。它在mac终端上运行得完美无缺,即使是在windows上的git bash中也是如此。
但是,如果我在windows终端或cmder中执行jar,它会抛出一个警告,而所有的完成器都不能工作。
WARNING: unable to create a system terminal, creating dumb terminal (enable debug logging for more information)我的pom是这样的:
<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>jline3Test</groupId>
<artifactId>jline3-test</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<configuration>
<createDependencyReducedPom>true</createDependencyReducedPom>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<excludes>META_INF/*.SF</excludes>
<excludes>META_INF/*.DSA</excludes>
<excludes>META_INF/*.RSA</excludes>
</excludes>
</filter>
</filters>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>Application</mainClass>
</transformer>
</transformers>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.jline</groupId>
<artifactId>jline</artifactId>
<version>3.8.0</version>
</dependency>
</dependencies>
问题:
提前感谢
发布于 2018-10-17 14:49:03
您需要在类路径上有jna (https://mvnrepository.com/artifact/net.java.dev.jna/jna)或jansi (https://mvnrepository.com/artifact/org.fusesource.jansi/jansi)。
有了这一点,您需要jline终端-jansi (https://mvnrepository.com/artifact/org.jline/jline-terminal-jansi)或jline-终端-jna (https://mvnrepository.com/artifact/org.jline/jline-terminal-jna),后者将这些与JLine3集成在一起。
因此,您可以选择使用jansi还是jna,但是必须有两个库。希望这能有所帮助。
也可以直接在Jline3文档中找到:https://github.com/jline/jline3#jansi-vs-jna
最好,马克
https://stackoverflow.com/questions/52851232
复制相似问题