IntelliJ IDEA 2017.3.4& Scala编译服务器:IDE无法连接到自己的本地服务器

时间:2018-02-20 16:40:31

标签: intellij-idea scala-compiler

我使用 IntelliJ IDEA 2017.3.4 作为Scala IDE。

我已激活" Build project automatically"选项并将Java 8 JDK设置为默认项目SDK。 enter image description here

贝娄,Scala compiler server配置 enter image description here

Scala compiler server 正在运行并侦听端口 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 Host 64位(Arch Linux)上运行

您对使用Scala compiler server需要做些什么了解吗?

1 个答案:

答案 0 :(得分:0)

我找到了一个解决方案,我需要对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,你会很高兴,它正在工作!