我开发多模块 SBT 项目。一般来说,它是一个akka api。当我在本地运行它以及将它打包到 docker 中时,它运行良好。
最近我添加了一个新的用于生成电子邮件模板的模块。为此,我决定使用scalate mustache。出于测试原因,我在email/src/main/resources/templates
.
然后我运行代码,该代码使用位于email/src/main/scala
. 一切都编译好了(scalate 模板和 scala 代码)。
在我将电子邮件模块的依赖项添加到应用程序模块中包含的安全模块之后:
import sbt.Keys._
import NativePackagerHelper._
lazy val core = project.in(file("core"))
.settings(name := "core")
.settings(Common.settings)
.settings(libraryDependencies ++= Dependencies.commonDependencies)
.enablePlugins(JavaAppPackaging)
lazy val email = project.in(file("email"))
.settings(name := "email")
.settings(Common.settings)
.settings(libraryDependencies ++= Dependencies.emailDependencies)
.enablePlugins(JavaAppPackaging)
lazy val contacts = project.in(file("contacts"))
.settings(name := "contacts")
.settings(Common.settings)
.dependsOn(core % "test->test;compile->compile")
.enablePlugins(JavaAppPackaging)
lazy val security = project.in(file("security"))
.settings(name := "security")
.settings(Common.settings)
.dependsOn(email, core % "test->test;compile->compile")
.enablePlugins(JavaAppPackaging)
lazy val app = project.in(file("."))
.enablePlugins(JavaAppPackaging, AshScriptPlugin, DockerPlugin)
.settings(name := "app")
.settings(Common.settings)
.dependsOn(core, security, contacts)
.settings(
mainClass in Compile := Some("com.app.Main"),
packageName in Docker := "app-backend",
version in Docker := "latest",
dockerBaseImage := "openjdk:8-jre-alpine",
dockerExposedPorts := Seq(5000)
)
我在尝试运行电子邮件代码时看到以下错误:
Exception in thread "main" org.fusesource.scalate.TemplateException: scala.tools.nsc.symtab.classfile.ClassfileParser$unpickler$.unpickle([BILscala/reflect/internal/Symbols$Symbol;Lscala/reflect/internal/Symbols$Symbol;Ljava/lang/String;)V
at org.fusesource.scalate.TemplateEngine.compileAndLoad(TemplateEngine.scala:886)
at org.fusesource.scalate.TemplateEngine.compileAndLoadEntry(TemplateEngine.scala:745)
...
如何使电子邮件模块代码在其他模块中工作?
附加信息:我尝试通过从应用程序模块运行 Main 类直接从 IDE 运行代码。斯卡拉版本 2.12.2;缩放版本 1.8.0;sbt 版本 0.13.8;