Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 created a new Scala SBT project with wizard, there was no src/ directory structure generated in the project. Only two sbt files were generated:

scala-course/ ├── build.sbt └── project     └── plugins.sbt 

From the video and other document I know that there should be a src/ directory structure, including src/main/scala, src/test/scala, etc. sbt uses the same directory structure as Maven for source files by default.

I can create those folders manually and mark it as source root. However it is trivial. So my question is: Why IntelliJ IDEA new project wizard doesn't generate the directory structure as said in document? Was I doing something wrong? I checked the preferences and couldn't find anything that seems related.

like image 965
aleung Avatar asked May 18 '14 12:05

aleung


People also ask

What does the src folder contain in an sbt project?

The project folder contains sbt configurations and settings, while src contains all your source code. sbt creates the target folder after you compile your code; it includes the JVM bytecode of your application.

How do I run an sbt Assembly in IntelliJ?

IntelliJ now allows you to create a run configuration for an SBT task. You create the Run Configuration by : choosing "Edit configurations" from the "Run" menu (or the toolbar popup) click the "+" button to add a configuration and select "SBT Task" as the type of configuration you want to make.


2 Answers

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

like image 118
lpiepiora Avatar answered Sep 18 '22 06:09

lpiepiora


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"?

like image 20
Zaptree Avatar answered Sep 18 '22 06:09

Zaptree