Reputation: 607
I've just installed SBT plugin for IntelliJ and successfully imported my project. SBT console in IntelliJ shows up as expected, however I can't use it because of layout of my project. The entire problem is that my SBT Play! project is not a top-level directory. Instead I have maven parent pom with several child modules amongst which my SBT application is placed. This is how it looks like:
MyProject (parent pom)
-> submodule1 (JAR)
-> submodule2 (JAR)
-> webapp (SBT Play! webapp module)
There is no problem to run Play! application from Linux CLI, previously changing directory to MyProject\webapp
and executing SBT from there. However, I don't see any option to set root dir for SBT console in IntelliJ. I have entire project imported into workspace, so the default project root directory is MyProject
which is obviously not treaded as SBT project.
Is there any way to change "working directory" for IntelliJ SBT plugin?
Upvotes: 4
Views: 3062
Reputation: 5216
I had the same issue, here's how I got it going:
import sbt._ import Keys._
object HelloBuild extends Build { lazy val root = Project(id = "MyProject", base = file(".")) aggregate(submodule1, submodule2, webapp) lazy val submodule1 = Project(id = "submodule1", base = file("submodule1")) lazy val submodule2 = Project(id = "submodule2", base = file("submodule2")) lazy val webapp = Project(id = "webapp", base = file("webapp")) }
reload
command to apply the changes.You can list the projects SBT recognizes as modules with the projects
command. Switch projects by using project [projectName]
. So to switch to submodule2, just type project submodule2.
Upvotes: 3