intellij-idea - IntelliJ IDEA 2017.3.4 & Scala 编译服务器 : IDE can't connect to its own local server

标签 intellij-idea scala-compiler

我正在使用 IntelliJ IDEA 2017.3.4 作为 Scala IDE。

我已激活“自动构建项目”选项并将Java 8 JDK 设置为默认项目SDK。 enter image description here

下面,Scala 编译器服务器 配置 enter image description here

Scala 编译器服务器 正在运行 并监听端口43558。我无法更改此端口,我认为这是受 IntelliJ IDEA 随机影响。

enter image description here

当我修改我的 Scala 源代码时,IntelliJ IDEA 不使用 Scala Compiler Server 以避免在很小的更改上重新编译许多类。由于这个原因,编译时间很长...

我得到以下错误: enter image description here

Warning:scalac: Cannot connect to compile server at localhost/127.0.0.1:3200
Trying to compile without it

注意:我在 Linux 主机 64 位 (Arch Linux) 上运行

关于使用 Scala compiler server 我需要做什么,你知道吗?

最佳答案

我找到了一个解决方案,我需要硬编码Scala Compile Server的端口

编辑文件 ~/.IntelliJIdea2017.3/config/options/scala.xml 并添加两个选项:COMPILE_SERVER_PORTCOMPILE_SERVER_MAXIMUM_HEAP_SIZE

您的文件需要看起来像下面的内容:

<application>
  <component name="ScalaSettings">
    <option name="COMPILE_SERVER_PORT" value="43558" />
    <option name="COMPILE_SERVER_ID" value="xxxxxxx-xxxxx-xxxxxx-xxxxxxxxxx" />
    <option name="COMPILE_SERVER_SDK" value="1.8" />
    <option name="COMPILE_SERVER_MAXIMUM_HEAP_SIZE" value="2048" />
  </component>

重新启动你的 IDE,你会很高兴,它正在工作!

关于intellij-idea - IntelliJ IDEA 2017.3.4 & Scala 编译服务器 : IDE can't connect to its own local server,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48890086/

相关文章:

shapeless - Functor 缺少参数实例的隐式值(仅在 sbt clean 之后)

git - 在 IntelliJ 项目中更改在线 git 存储库 url

java - 为什么idea和eclipse中ContextConfiguration位置不同

scala - Scala 编译器如何进行隐式转换?

scala - 如何在 Scala 中获取动态创建类的完整类名

scala - 除了在宏中给我源位置之外,-Yrangepos 的作用是什么

java - Android Studio 无法运行项目 - 错误 :Execution failed for task ':app:preDexDebug' .

scala - IntelliJ IDEA 12 与 sbt 0.13

intellij-idea - IntelliJ IDEA - 字体 Fira Code 已安装但未显示在菜单中

Scala - 如何在运行时从外部文件编译代码?