IntelliJ Cannot Import sbt Project

前端 未结 14 2108
Happy的楠姐
Happy的楠姐 2021-01-29 23:14

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
           


        
14条回答
  •  广开言路
    2021-01-29 23:52

    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

    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.

提交回复
热议问题