sbt-idea
sbt-idea copied to clipboard
in multiple projects setup, the project-build content root is incorrect
If you have project setup like Parent depends on Child1 and child2
parent/project parent/child1/project parent/child2/project
at parent you run
sbt gen-idea
the conten root of the project-child1-build and project-child2-build all points to project-parent-build which is "parent/project" instead of parent/child1/project and parent/child2/project
IDEA complains about this is you trying to edit project structure.
Yes, this kind of setup is probably not correctly supported right now. I think this is pretty rare setup(?), as I don't remember seeing a single project with dedicated project definition directory for every child project.
Pull requests welcomed! :)
Thanks for looking at. The sbt-idea plugin is great. Saved me a lot of times. The project setup came from following consideration. I want to enforce the clear separation for different child projects, so they can develop and tests independently, of course, we module/project level dependency.
So all the children projects can be considered as independent projects, where the dependency among them is specified via jar file in SBT files. These jar files are produced and published via sbt publish-local
But at the same time, this kind of setup is not efficient for development, as we might need to change several child projects to make different but related changes.
So we thought, we can simple create a parent-child project structure by bringing the child projects directly into the parent project with minimal changes in child sbt configuration (removing the jar dependency and replace it with parent-level specified project dependency)
With this setup, the child project can be split from parent project if we wish too, and become a independent project very easily.
Ok, thanks for the details. Sounds like a reasonable use case.
Could you create a simple example project to github, demonstrating the issue?
Having the same issue. Started a new project and configured it in .scala file like this:
import sbt._
import Keys._
object IntegrationBuild extends Build {
lazy val root = Project(id = "integration-root",
base = file(".")) aggregate(server, client)
lazy val messages = Project(id = "integration-messages",
base = file("integration-messages"))
lazy val server = Project(id = "integration-server",
base = file("integration-server")) dependsOn (messages)
lazy val client = Project(id = "integration-client",
base = file("integration-client")) dependsOn (messages)
}
Don't know why, but every time I do a gen-idea
, Idea forgets about configured JDK, so I have to reset it. And set content root to every -build
subproject. Wich isn't all that difficult, just a little bit annoying) Would appreciate if that bug is solved.
Don't know why, but every time I do a gen-idea, Idea forgets about configured JDK
What are your JDK names in Idea? Only "1.6" and "1.7" work, I think. The one added to Idea metafiles is based on the java version you run 'gen-idea' with.
Yep. I have a JDK named "1.7" configured, but it seems that gen-idea adds another JDK named "1.7 (2)" and it is somehow misconfigured... Here's a screenshot.
Also wow, it's possible to configure JDK for the whole project))))))) And here I was resetting it for every subproject :(
I created a sample multi project setup in https://github.com/chesterxgchen/multiproject
you can run sbt gen-idea on the parent project to see the issue.
Thanks @chesterxgchen!
I am having this issue. It is not very hard to fix by hand, but it is a nice to have.