2

我正在尝试根据指南将 MyBatis 与 Play Framework 2.2 集成。本指南是为 Play v2.1.x 编写的,它使用project/Build.scala而不是build.sbt.

在这种情况下,如何将映射器 xml 文件添加到类路径?

以下文章中使用的配置摘录:

val main = play.Project(appName, appVersion, appDependencies).settings(
  // Add app folder as resource directory so that mapper xml files are in the classpath
  unmanagedResourceDirectories in Compile <+= baseDirectory( _ / "app" ),
  // but filter out java and html files that would then also be copied to the classpath
  excludeFilter in Compile in unmanagedResources := "*.java" || "*.html"
)
4

1 回答 1

8

设置只需在build.sbt文件中添加一个额外的换行符而不是逗号,因此:

unmanagedResourceDirectories in Compile <+= baseDirectory( _ / "app" )

// but filter out java and html files that would then also be copied to the classpath
excludeFilter in Compile in unmanagedResources := "*.java" || "*.html"

空行是必需的!

于 2013-11-03T14:47:17.587 回答