I want to combine the Module Dependencies with the ones from the parent Module.
I have the following in my build.sc
:
trait ExampleModule extends ModuleWithTests {
override def moduleDeps = Seq(camunda, cli)
}
object twitter extends ExampleModule {
override def moduleDeps = super.moduleDeps ++ Seq(twitterApi)
}
This gives me:
build.sc:222: type mismatch;
found : Seq[build.this.ModuleWithTests]
required: Seq[build.this.ModuleWithTests{def moduleDeps: Seq[build.this.ModuleWithTests]}]
override def moduleDeps = super.moduleDeps ++ Seq(twitterApi)
^
build.sc:222: `T.command` definitions must have 1 parameter list
override def moduleDeps = super.moduleDeps ++ Seq(twitterApi)
^
Compilation Failed
Is there a way to achieve this, or do I have to list the module dependencies in each child module?
Your example is almost right, but because you omitted the explicit return type of ExampleModule.moduleDeps
it seems the compiler inferred a more specific type of Seq[ModuleWithTests]
in this case. Looks like all your modules camunda
and cli
also implement this trait. Whereas twitterApi
seems to not implement it.
To fix the compile error, you might try to add the explicit return type Seq[JavaModule]
to ExampleModule.moduleDeps
.