1
votes

When I create a SBT Scala project with Intellij Idea 14.0.3, I end up with the following project structure:

newly created project

The problem is, src folder is under the project root and then there is the project node at the same level (highlighted in the screenshot)

I could not find any documentation that explains this layout and it is very confusing. I've managed to compile and deploy scala apps but what is that project node doing? What use do I have for it? What artefacts, if any are supposed to go under it?

1
The project folder inside is supposed to contain the generated assets, which are used by the build tool sbt in its build process. Why are you bothered by that project folder ?sarveshseri
mostly because it is marked as (sources root). It makes me think that that's where I'm supposed to put the sources. there is also a target folder next to src, so if sbt project output is going to go into project/... what is the role of the target folder next to src then?mahonya
Well... as I mentioned project folder inside is supposed to contain the generated assets and some other things, which are used by the build tool sbt in its build process. In simple terms the target folder contains final generated assets after the build process.sarveshseri

1 Answers

1
votes

In general, and SBT project is a Scala project on its own, so you can in some cases see a whole hierarchy of "project" folders with their own artifacts, etc.

(your project) / project / project / ... (up to infinite complexity)

As a project, it can have its own sources, target, etc. In most cases you will never need to go into the project folder at all, but you might if you want to change the way SBT is doing things, for instance, to enable SBT plugins.

The src/, target/ etc. folders on the root of your project are the ones that apply for your project.