Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ can't connect to its own Scala compile server

I am using latest IntelliJ IDEA (2016.1.1) - but I have seen this behaviour in previous versions too - developing in Scala with latest Scala plugin (3.0.3).

When I try to Run/Debug a test or code, IDEA will start Making the project, but will then stay there several seconds while the "Make" progress bar doesn't progress at all.

After 20-30 seconds of this, the following message appear in the Messages tab:

Warning:scala: Cannot connect to compile server at localhost/127.0.0.1:59656 Trying to compile without it

The port shown there, 59656, is a port I hard-coded myself in %USER_PROFILE%\.IntelliJIdea2016.1\config\options\scala.xml, after I noticed this problem the first time on the default port, so changing the port did not help...

At this point, the bar will read "Reading compilation settings..." for several more tens of seconds before the code actually runs. It is terribly bothering and I can't seem to be able to fix it definitively. This can easily take up to 3 minutes to run a single test. Very disrupting. I noticed this problem happening intermittently on my work machine (Win7).

Anyone has any idea how to debug/fix this issue?

Thanks

like image 317
mdm Avatar asked Apr 29 '16 08:04

mdm


People also ask

How do I select Scala version in IntelliJ?

Press Ctrl+Alt+S to open Settings/Preferences dialog. From the options on the left, select Build, Execution, Deployment | Compiler | Scala | Scala Compiler Server.

Does IntelliJ work with Scala?

To start working with Scala in IntelliJ IDEA you need to download and enable the Scala plugin. If you run IntelliJ IDEA for the first time, you can install the Scala plugin when IntelliJ IDEA suggests downloading featured plugins. Otherwise, you can use the Settings | Plugins page for the installation.

How do I add Scala framework support in IntelliJ?

To add Scala support to existing module:Right-click the module in Project View, choose “Add Framework Support…” Check “Scala” in technologies list (unavailable if module has Scala facet attached) Provide a path to Scala installation (if not detected)


1 Answers

I had the same problem, and it was caused by conflicting settings files between the settings repository and the local preferences. Your compile server settings are store in a file called scala.xml in your IDEA preferences dir.

If you use "settings sync", i.e. an online repository to sync your IDEA settings, make sure that you have only one scala.xml config file. Go to your Library/Preferences/<IDEA-Dir>/ and remove that file from the options and settingsRepository dirs. This resets to "factory settings".

Restart IntelliJ, setup the compile server again. It should now only write one file, to the settingsRepository dir, with a new ID and port allocation for the compile server.

This fixed it for me.

like image 140
Matthias Avatar answered Sep 29 '22 17:09

Matthias