Reputation: 21
Im trying to use a single Intellij IDEA window with multi projects (that are not related) imported.
The problem that I'm facing is when I'm executing a sbt task
, the task is not loaded in the right project directory.
This is what I did (all in the Intellij Idea window):
root
empty sbt project.+
and added 2 projects job-service
and user-service
(each was its own build.sbt
file)Reimport All sbt projects
just for funcompile
(from the sbt toolbar) for the user-service
The sbt shell opened, and started compiling the empty root project:
[info] Set current project to root (in build file:/Users/dima/git/root/)
[IJ]sbt:root> compile
what I've expected is
[info] Set current project to user-service (in build file:/Users/dima/git/user-service/)
And of course, the same for the second project job-service
Versions:
Idea version: Version: 2019.2 Build: 192.5728.98
SBT version = 0.13.18
I know the way to use a single build.sbt
file with multi projects. But those projects are not related. each project has its own build.sbt
file.
I just want to use a single Idea window with multiple projects. and that the sbt toolbar could execute the tasks to the right project
Thanks!
EDIT:
This is the process to recreate what I'm facing:
learner
the same for publishLocal
task. it sets the current project to root2 and publishes a root2 artifact.
what should have been, is that the sbt would set the current project to learner
Upvotes: 2
Views: 3279
Reputation: 480
I have this problem on IntelliJ some time ago, but in that moment my project was not sbt
related. That project contains two different applications in different programming languages, so they could not have a common build file.
But I've found a solution to solve this problem which was using IntelliJ Modules
. These Modules
will let you create different projects inside your current workspace.
You can access it in File -> Project Structure... -> Modules (In the left panel)
I think you can use this feature to accomplish your expected result. Hope it helps!
Upvotes: 1