72

I have upgraded IntelliJ to version CE 2017.3 from a CE 2017.2.5, and now I cannot build my sbt project. The build gets stuck on the first step:

"Build: sync
  MyProjName: syncing...
   dump project structure from sbt"

I have deleted the .idea directory and the the MyProjName/project/target directory. I did an sbt build from the command line, which worked. Then I started IntelliJ again and tried to import MyProjName/build.sbt as a project. I have also logged out/in. Did this several times. The import never progresses past this step.

I work behind a firewall, but I have checked my proxy settings, and they are correct and unchanged from the previous version (if this matters).

How can I troubleshoot / fix this?

The sbt version is 0.13.6. Scala plugin 2017.3.10.

From the log:

IDE: IntelliJ IDEA (build #IC-173.3727.127, 27 Nov 2017 09:32)
OS: Windows 7 (6.1, amd64) 
JRE: 1.8.0_152-release-1024-b6 (JetBrains s.r.o) 
JVM: 25.152-b6 (OpenJDK 64-Bit Server VM) 
13
  • what is the previous version of your idea . I have 2017.2.6. Aslo let us know the sbt, scala, java version.
    – user51
    Commented Dec 7, 2017 at 14:59
  • 5
    For me it took almost an hour to go beyond this step on Ultimate 2017.3
    – fR0DDY
    Commented Dec 7, 2017 at 20:05
  • 2
    Maybe this is related youtrack.jetbrains.com/issue/SCL-13147 Commented Dec 18, 2017 at 20:46
  • 1
    FYI, a new IntelliJ is out. Maybe give it a whirl? 2017.3.3 Commented Jan 22, 2018 at 22:22
  • 1
    Nope, still takes ages to import a large multi-module project.
    – rabejens
    Commented Jan 23, 2018 at 12:43

14 Answers 14

96

I solved the sync issue following info here: https://youtrack.jetbrains.com/issue/SCL-13024

Key info is "It seems that sbt is trying to re-resolve 'sources' and 'docs' for sbt plugins that are not available at all. If properties to download "Library sources" and "sbt sources" are disabled, then time to dump the structure is reduced from 'forever' to less than 1 minute."

That is , in IntelliJ IDEA, clear the check box "Library sources" under "Project level settings" for Build Tools sbt in IDEA preferences. As shown in image below:

enter image description here

6
  • this is the only one that worked for me on community edition 2017.3.4
    – nont
    Commented Feb 8, 2018 at 17:01
  • This worked for me on community edition 2017.3.4 on a 3G hotspot
    – vpipkt
    Commented Feb 28, 2018 at 17:24
  • This worked on 2018.1, just as a reminder you can still download sources when accessing its references(which for me looks faster as i will download them by demand). Commented Apr 28, 2018 at 17:03
  • Worked on 2018.1.4.
    – Henry
    Commented Aug 23, 2018 at 22:53
  • Works on 2019.1 for me. Thanks! Commented Apr 4, 2019 at 6:35
15

The only way I could work around this was by running sbt clean compile in the SBT console/cmd line first, then refreshing the SBT project in IntelliJ.

2
  • I have installed the latest 2017.3.3 (built 2018-01-15), and opened my project. It has started "dumping project structure from sbt", so I stopped that process and tried "clean compile" in the sbt console. Error: "No valid parser available" Commented Jan 22, 2018 at 23:56
  • Refreshing can be done by clicking File -> Synchronize Commented Oct 1, 2019 at 8:48
11
  • Open a terminal inside IDEA by pressing Alt F12 or use sbt shell
  • Run sbt - if it is first time it will take some time.
  • Run clean
  • Run compile - it will download dependencies you have in your project.
  • Close IDEA project (File -> Close Project) and open it again.

Note: if it asks to import in the right-bottom of the screen activate Enable auto-import, if you don't like to keep it enabled (like me) press Import, cancel the syncronyzation and then Refresh sbt project again. When you try to use import in the middle of a sync it gets stuck with dump project structure from sbt message.

The Refresh sbt project is located at this corner of the Build Sync window - highlighted below: Refresh sbt project

1
  • 1
    This is working solution. This should be mark for answer. Commented Jul 1, 2019 at 12:46
6

I have not found a way to make this work in IntelliJ Idea CE 2017.3, so I have reverted to CE 2017.2.5

1
  • I added a new answer to this question. Let me know if what worked for me helps.
    – marios
    Commented Jan 11, 2018 at 0:09
6

IntelliJ appears to limit the efficiency of the already slow sbt update. I recommend using sbt-coursier instead. It was written specifically to improve dependency update time, and on one large project I'm involved in it improved dependency update time by about 2 orders of magnitude.

  1. Uncheck "Use auto-import" in Preferences > Build, Execution, Deployment > Build Tools > sbt to prevent IntelliJ from auto updating imports on its own

enter image description here

  1. Add addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.3") to your project's build.sbt file
    • Or install it globally in ~/.sbt/1.0/plugins/build.sbt
  2. Run sbt update on the command line

If you see [error] java.lang.NoClassDefFoundError: org/vafer/jdeb/Console, then add the following to ~/.sbt/1.0/sbt-coursier.sbt.

import coursier.Keys._
classpathTypes += "maven-plugin"

See coursier issue #450 for more information about that error.

  1. (Optional) Re-enable auto-import from step 1, as subsequent transactional dependency updates may be faster.
4

I meet the same problem! I delete the directory ~/.sbt/0.13, then it works. You can delete the sbt directory you used.

2
  • I just tried that, and for me it made no difference Commented Jan 23, 2018 at 2:10
  • 1
    After deleteing I also increased the max heap as suggested in marios anwser. Then it took about 10 minutes (first time). I don't know if changing the Max heap helped or not.
    – ioleo
    Commented Jan 24, 2018 at 12:01
4

What worked for me was to increase the memory for SBT inside IntelliJ. On my Mac: preference -> Build, Execution, Depoyment -> sbt then change "Maximum heap size" from 768MB to 2048MB and then everything was successfully imported after few minutes.

5
  • I have installed the latest 2017.3.3 (built 2018-01-15), and set the max heap to 4096 Mb. It still cannot finish "dumping project structure from sbt" Commented Jan 23, 2018 at 0:02
  • Could take a while the first time. How long did you wait?
    – marios
    Commented Jan 23, 2018 at 3:38
  • 10-20 min (this time). The previous time I installed 2017.3 I waited 11h. So I don't have a lot of patience for this particular bug. I have re-installed 2017.2 and it worked right away. Commented Jan 23, 2018 at 3:41
  • 1
    I did delete the .sbt/0.13/ dir. Then it took about 10 minutes (first time). I don't know if changing the Max heap helped or not.
    – ioleo
    Commented Jan 24, 2018 at 12:00
  • now that you mentioned it, I also deleted .sbt/0.13/. probably the deletion and the increase in memory did the work.
    – marios
    Commented Jan 25, 2018 at 4:22
2

Custom SBT version works for me.

IntelliJ IDEA Preferences -> Build,Execution,Deployment -> Build Tools -> sbt -> Launcher

Choose Custom

custom sbt screenshot

0
2

For me, simply checking use sbt shell for both build and imports worked.

1

Had an older checked out project causing this issue. Did the usual rm -rf .idea + re-import but it kept getting stuck. Tried all sorts of things, but when finally fixed it for me was not just deleting the top-level target folder, but instead doing

find . -name target -type d -exec rm -rf {} \;

Next open / import went flawlessly. (This was on 2018.1.5, 2018.1.6 and 2018.2 RC.)

0

I have suffered from same problems after upgrade intelliJ to 2017.3 But it works fine now.

I think intelliJ couldn't pass the 'No proxy for' option to sbt. so, I added

-Dhttp.nonProxyHosts="host1|host2"

option in File > Settings > Build, Excution, Deployment > sbt > VM parameters

0

Simply unchecking 'sbt sources' did the trick for me

0

I was also facing this issue. Below two configurations worked for me. I tried to confirm this setting in many new sbt projects, for all it worked.

(1) uncheck "Library sources" under "Project level settings" for Build Tools sbt in IDEA preferences (2) -Dhttp.nonProxyHosts="host1|host2" option in File > Settings > Build, Excution, Deployment > sbt > VM parameters

0

I hit similar issue but found it's related to waiting for locks

  • ~/.sbt/tool/sbt.boot.lock
  • ~/.ivy2/.sbt.ivy.lock

Maybe if killing IntelliJ IDEA and no one will release the lock files, the issue is resolved after deleting locks files manually

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.