I have a multi module SBT project with this structure:

➜  Stample git:(split-in-sbt-modules) ✗ tree -L 1
.
├── project
├── stample-core
├── stample-search
├── stample-web
└── target

The build definition is pretty simple and looks like:

  lazy val stampleWebProject = play.Project("stample-web", appVersion, appDependencies,path = file("stample-web"))
    .dependsOn(stampleCoreProject,stampleSearchProject)
    .aggregate(stampleCoreProject,stampleSearchProject)

  lazy val stampleCoreProject = Project(id = "stample-core",base = file("stample-core"))

  lazy val stampleSearchProject = Project(id = "stample-search",base = file("stample-search"))

I'd like to know why when I generate the IDEA project files with sbt-idea plugin, the build definition /project is not imported as a module.

It seems it is supposed to be, and I am pretty sure that I already saw it working on my own project but can't make it work again :( By the way, for newly created Play2 projects, when we use the plugin to generate the IDEA files, the project is also imported as an IDEA module with the appropriate classpath.

This issue seems say it is the expected default behavior.

I use v 1.5.1 but tried an older version and it doesn't work either.

When I run the gen-idea command I get:

[info] Excluding folder .ideacalaz-core_2.10;7.0.0 ...                            
[info] Excluding folder .idea_modules
[info] Excluding folder target
[info] Excluding folder target
[info] Created /home/sebastien/Bureau/Stample/.idea/IdeaProject.iml
[info] Created /home/sebastien/Bureau/Stample/.idea
[info] Excluding folder /home/sebastien/Bureau/Stample/stample-core/.idea
[info] Excluding folder /home/sebastien/Bureau/Stample/stample-core/.idea_modules
[info] Excluding folder /home/sebastien/Bureau/Stample/stample-core/target
[info] Excluding folder /home/sebastien/Bureau/Stample/stample-core/target
[info] Created /home/sebastien/Bureau/Stample/.idea_modules/stample-core.iml
[info] Excluding folder /home/sebastien/Bureau/Stample/stample-search/.idea
[info] Excluding folder /home/sebastien/Bureau/Stample/stample-search/.idea_modules
[info] Excluding folder /home/sebastien/Bureau/Stample/stample-search/target
[info] Excluding folder /home/sebastien/Bureau/Stample/stample-search/target
[info] Created /home/sebastien/Bureau/Stample/.idea_modules/stample-search.iml
[info] Excluding folder /home/sebastien/Bureau/Stample/stample-web/.idea
[info] Excluding folder /home/sebastien/Bureau/Stample/stample-web/.idea_modules
[info] Excluding folder /home/sebastien/Bureau/Stample/stample-web/target/scala-2.10/cache
[info] Excluding folder /home/sebastien/Bureau/Stample/stample-web/target/scala-2.10/cache
[info] Excluding folder /home/sebastien/Bureau/Stample/stample-web/target/scala-2.10/classes
[info] Excluding folder /home/sebastien/Bureau/Stample/stample-web/target/scala-2.10/classes
[info] Excluding folder /home/sebastien/Bureau/Stample/stample-web/target/scala-2.10/classes_managed
[info] Excluding folder /home/sebastien/Bureau/Stample/stample-web/target/scala-2.10/classes_managed
[info] Excluding folder /home/sebastien/Bureau/Stample/stample-web/target/native_libraries
[info] Excluding folder /home/sebastien/Bureau/Stample/stample-web/target/native_libraries
[info] Excluding folder /home/sebastien/Bureau/Stample/stample-web/target/resolution-cache
[info] Excluding folder /home/sebastien/Bureau/Stample/stample-web/target/resolution-cache
[info] Excluding folder /home/sebastien/Bureau/Stample/stample-web/target/scala-2.10/resource_managed
[info] Excluding folder /home/sebastien/Bureau/Stample/stample-web/target/scala-2.10/resource_managed
[info] Excluding folder /home/sebastien/Bureau/Stample/stample-web/target/scala-2.9.2
[info] Excluding folder /home/sebastien/Bureau/Stample/stample-web/target/scala-2.9.2
[info] Excluding folder /home/sebastien/Bureau/Stample/stample-web/target/streams
[info] Excluding folder /home/sebastien/Bureau/Stample/stample-web/target/streams
[info] Created /home/sebastien/Bureau/Stample/.idea_modules/stample-web.iml

Can someone explain my why the project module is not created?

有帮助吗?

解决方案

So in the end, it seems the plugin doesn't generate the build definition module if the parent folder is not included as an SBT project.

Adding this line seems to fix all my problems:

lazy val stampleRootProject = Project(id = "stample",base = file("."))
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top