如何在Play Framework 2.2中自定义unmanagedResourceDirectories和excludeFilter?

Max*_*sky 2 java sbt mybatis playframework playframework-2.2

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

在这种情况下,如何将mapper xml文件添加到classpath?

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

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"
)
Run Code Online (Sandbox Code Playgroud)

Rob*_*een 7

设置只是在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"
Run Code Online (Sandbox Code Playgroud)

空白行是必需的!