How can I share the definition of a Simple Build Tool module project
between many parent projects?
and at the same time
include the module project definition in each parent project build file?
Clarification:
I have a parent project, and a Dao module project and a App module project and a Core project. Both module projects (i.e. Dao and App) depend on (the exact same version of) Core:
Parent project
|
|--> app
| `--> core
|
`--> dao
`--> core
I defined App, Dao and Core in their own project directories, (as described here)
so they can be resued by many parent projects.
However, when I load the parent project, SBT gives this error:
The same directory is used for output for multiple projects
So instead I copied the App, Dao and Core project definitions into the parent project definition. That is, declared all projects and their dependencies in the single build file of the parent project.
Now everything works fine.
However, I have many parent projects. Each parent project uses different versions of the App project and the Dao project. (DAO = Data Access Object -- e.g. database storage or file storage, varies from project to project.)
So I'd need to repeat the definitions of App and Dao in each parent project, to avoid the The same directory is used for output for multiple projects
error. But the result would be lots of duplicated project build code!
How can I avoid this?
I have one idea: Perhaps I can create a module for e.g. the Dao project, with a trait
that declares all Dao's dependencies (on 3rd party libraries). Then there would be almost no duplicated code, only the dependency from Dao on Core would be repeated in each parent project.
What do you think?
Do you perhaps have some other ideas?