我有一个包含三个模块的项目。从另一个模块扩展特质
- 主要
- 域
- 基础设施
在域模块我有一个实体类和库特征。
Entity.scala
EntityRepository
在基础设施模块我要扩展和实现的EntityRepository特质。
EntityRepositoryImpl extends EntityRepository {...}
但我不知道如何从基础设施模块访问领域mobdule中的特质。
我不知道我知道我在做什么,但在这里通过build.sbt。告诉我,如果我在那里做错了什么。
import play.Project._
lazy val domain = Project("domain", file("domain"))
lazy val infra = Project("infrastructure", file("infrastructure")).dependsOn(domain)
lazy val root = Project("MainModuleName", file(".")).dependsOn(domain, infra)
name := "AppName"
version := "1.0"
playScalaSettings
现在突然我可以找到EntityRepositoryImpl的EntityRepository但是当我选择把它扩大它仍然是红色,呈现出“无法解析...'-错误。
快乐任何形式的反馈! 感谢
在IntelliJ中编译器出现错误,或者运行“sbt compile” ? –
@RadoBuransky编译器没有错误。那么如果我添加“扩展EntityRepository”它会失败,因为EntityRepository无法找到。我的意思是,我无法在EntityRepositoryImpl类中导入该特征。 – raxelsson
这就是我所问的。错误消息是来自IntelliJ还是SBT。这可能是IntelliJ项目不是最新的。运行“sbt gen-idea”(如果您使用该插件)从build.sbt重新生成IntelliJ项目。 –