我真的希望 sbt 及其控制台能够在 cygwin 下以任何你认为可以做到的方式工作? [英] i really would like sbt and its console to work under cygwin any way you think it can be done?

查看:28
本文介绍了我真的希望 sbt 及其控制台能够在 cygwin 下以任何你认为可以做到的方式工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个问题(https://github.com/sbt/sbt/issues/562)基本上,当我尝试获取控制台时,它会说:

i have this issue (https://github.com/sbt/sbt/issues/562) basically when I try to get a console it says:

[ERROR] 构建终端失败;退回到不支持的java.lang.IllegalArgumentException:无效的终端类型:jline.UnixTerminal

[ERROR] Failed to construct terminal; falling back to unsupportedjava.lang.IllegalArgumentException: Invalid terminal type: jline.UnixTerminal

你也不能使用退格键

您基本上不能在 cygwin 中使用 sbt(在 dos 中很好,但 cygwin 是一个更好的环境)并在那里表达了我的担忧

you basically cannot use sbt in cygwin (in dos is fine but cygwin is a much nicer environment) and have voiced my concern there

我已经尝试了几种我在网上找到的解决方法,但它们都是旧版本的,现在没有用

i have tried several workaround i found on the net but they are all for old releases and no use now

只是想知道您是否知道任何解决方法?

was just wondering if you know of any workaround?

谢谢

推荐答案

以下对我有用(大部分情况见底部注释):

The following works for me (mostly, see note at bottom):

  1. 使用薄荷壳.我相信这是新 cygwin 安装的默认 shell,但作为替代方案已经包含了一段时间.如果您的 <cygwin home>in 文件夹中存在 mintty.exe,则可以使用它,否则可以通过 setup.exe 中的典型 cygwin 包选择来安装它.
  2. 打开一个 mintty 窗口,右键单击任意位置,转到 Options... -> Keys,并确保 Send Backspace as ^H 被选中.这将允许 REPL 正确解释退格.
  1. Use the mintty shell. I believe this is the default shell for new cygwin installs but has been included as an alternative for a while. If mintty.exe exists in your <cygwin home>in folder then it's ready to use, else it can be installed through the typical cygwin package selection from the setup.exe.
  2. Open a mintty window, right click anywhere, go to Options... -> Keys, and make sure Send Backspace as ^H is checked. This will allow the REPL to correctly interpret backspaces.

只需要运行 Scala REPL 就可以了,但尝试运行 sbt console 仍然会产生该异常.为了解决这个问题,运行 sbt 不带任何参数进入 sbt 提示符.从那里执行:

For just running the Scala REPL that should be all you need, but attempting to run sbt console can still produce that exception. To get past that, run sbt without any arguments to get to the sbt prompt. From there execute:

eval System.setProperty("jline.terminal", "scala.tools.jline.UnixTerminal")

然后

console

或者,作为单个命令(两个分号都很重要):

or, as a single command (with both semi-colons being important):

; eval System.setProperty("jline.terminal", "scala.tools.jline.UnixTerminal") ; console


据我所知,这至少部分是由 Scala REPL 和使用不兼容版本的 JLine 的 sbt 提示引起的.特别是,看起来 Scala REPL 围绕库创建了自己的包装器,并且正在使用它,而 sbt 直接使用 JLine 库.


From what I can tell, this is caused at least in part by the Scala REPL and the sbt prompt using incompatible versions of JLine. In particular, it looks like the Scala REPL created their own wrappers around the library and are using that while sbt is using the JLine library directly.

我继续遇到的一个限制是,即使 shell 窗口有更多的水平空间,REPL 也会在第 80 列处换行.不仅如此,当 REPL 像这样换行时,它会覆盖同一行而不是前进到下一行,并且从历史记录中拉出长行最终会将光标推到您实际编辑的行上方.

One limitation that I continue to run into is that the REPL wraps at column 80 even if the shell window has more horizontal space. Not only that, but when the REPL wraps like this it overwrites the same line rather than advancing to the next, and pulling long lines from history ends up pushing the cursor above the line you're actually editing.

这篇关于我真的希望 sbt 及其控制台能够在 cygwin 下以任何你认为可以做到的方式工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆