IntelliJ IDEA 13: new Scala SBT project hasn't src directory structure generated

后端 未结 4 2077
走了就别回头了
走了就别回头了 2021-02-03 23:06

I followed the getting start video on Jetbrains website to setup IntelliJ IDEA 13.1 Community Edition to work with Scala. Scala plugin v0.36.431 had been installed. While I crea

相关标签:
4条回答
  • 2021-02-03 23:13

    Normally it should create these folders automatically. It may take a while though - it takes couple of seconds in my case.

    When creating project make sure you have selected Scala -> SBT, then proceed with the wizard.

    Once the Finish is clicked, the project will be loaded. This part takes couple of seconds, and I can see no src/main/scala nor src/test/scala generated until it's done. Observe the bottom of the screen to see when it's done.

    Loading Process

    Once the process is finished, you'll see the folders.

    Loaded Done

    If that's not the case, check the settings. You should have the Create directories for empty content roots automatically checked. You may want to check Use auto-import to automatically propagate changes in the build.sbt.

    Settings

    After changing the settings (if the change is required) you may need to refresh the project, as seen in picture below.

    Refresh Settings

    0 讨论(0)
  • 2021-02-03 23:13

    I followed the instructions in this thread but I had a java crash in the final phase in sbt with the configuration bellow and I think this info maybe useful:

    The problem happened with IDEA 2016.2, sbt 0.13.8 (I tried later to import using 0.13.12 but the crash was the same), scala 2.11.8 and ubuntu 16.04.

    The only way I could make it work was to use java 8 instead of 9.

    error: error while loading package, Missing dependency 'object java.lang.Object in compiler mirror', required by /home/jbamaral/.sbt/boot   at xsbt.boot.Boot.main(Boot.scala)
    ... 
    stack log here
    ...
    [error] scala.reflect.internal.MissingRequirementError: object java.lang.Object in compiler mirror not found.
    
    0 讨论(0)
  • 2021-02-03 23:15

    This can also happen if you do not have a JDK selected. For some reason you no longer get the option to select an SDK so you must make sure you have configured this before hand. To fix this do the following:

    From the welcome screen, go to 
    Configure -> Project defaults -> Project structure and add the jdk.
    

    Source: What's the reason for "Error:Cannot determine Java VM executable in selected JDK"?

    0 讨论(0)
  • 2021-02-03 23:32

    Thanks to lpiepiora, with his hint I find out the reason.

    Because my sbt is newly installed, there is nothing in ~/.ivy2/cache/ and ~/.sbt/boot/. sbt needed to download required dependencies from repositories on network. It happened that my proxy to internet had something wrong, download stuck.

    And also need to notice that, if quit IntelliJ IDEA when sbt is running in background, the next time you'll get error of waiting for some lock file. Have to remove the lock file on filesystem and restart IntelliJ IDEA again.

    After fixed the network problem, everything work as promised. It requires several minutes, depends on network speed, to download required jar files. After finished, the src/ directory structure is created.

    0 讨论(0)
提交回复
热议问题