Newcomer to the Intellij IDE here, with no Java background. I've looked at Build Definition to get a brief idea on how should I organize my scala files, but their example doesn't cover the full structure of an SBT-based project shown attached.
Can you advise what each folder should be used for (e.g. where my source files should go, etc.) and also point me to sources where I can go read up more.
Thanks so much
It is described pretty well here: http://www.scala-sbt.org/0.13.5/docs/Getting-Started/Directories.html
But to sum up.
.idea: This contains the project files for your idea project, and has nothing directly to do with sbt itself. However idea (if auto refresh is enabled) update its own project, each time the sbt build files change.
project: This contains the sbt project files, execpt for the main build file (files ending in sbt). Sbt builds is itself based on scala, and if you need to have some scala code included in your build, then you can place scala source files in this directory. The code of these files can be used in your build system, and is not part of your project itself. To really understand how a build is made, then your will need to understand the difference in how sbt files and scala files for the build should be placed. When your run sbt, then it will search for .sbt files in the directory your are standing in, when these are found, it will search for scala files in the project dir. These files together is the source of the build system, but because these are source files, they need to be build before they can be used. To build this build system, sbt uses sbt. So a build system to build the build system is needed. It therefore looks for sbt files inside the project dir, and scala files for this build inside project/project and build these files to get a build system, that can build the build system (that can build your project). Actually it can continue recursive down to any project/project/p... dir, until it finds a project folder containing no scala files, and therefore needs no building before use.
The target folder inside project, is the target folder for the sbt build of your build definition. See below what a target folder is.
Normally your would not need to concern about this, but just remember that build.sbt in your root directory, is the build script for your project. project/plugins.sbt defines plugins activated for your build system, and project/build.properties contains speciel sbt properties. Currently the only sbt property I now of, is what version of sbt should be used.
src: This is where your place the source files of your project. Your should place any java sources in src/main/java, scala sources in src/main/scala. Resources are placed in src/main/resources.
The src/main/scala_2.11 folder is typically used, if your have some code that it not binary compatible with different versions of scala. In such cases your would be able to configure sbt to use different source files when building for different versions of scala. Your properly do not need this, so I would advise to just delete the src/main/scala_2.11 folder.
Test sources are placed inside src/test/java and source/test/scala, and test resources are placed in src/test/resources.
target This folder is the target folder for sbt. All compiled files, generated packages and so on are placed somewhere inside this dir.
Most things in this dir is normally not so interesting, as most of it is just internal sbt things. However if your build a jar file by calling
sbt package, then it will be placed inside target/scala-x (where x is the scala version). There are also a lot of different plugins, that can package your application in different ways, and they will normally also place the package files somewhere inside the target dir.