简体   繁体   中英

How to customize unmanagedResourceDirectories and excludeFilter in Play Framework 2.2?

I'm trying to integrate MyBatis with Play Framework 2.2 according to the guide . This guide is written for Play v2.1.x that uses project/Build.scala instead of build.sbt .

How can I add mapper xml files to classpath in this case?

Excerpt from the configuration used in article below:

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"
)

Settings just go in the build.sbt file with an extra newline in between them instead of the comma, so:

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"

The blank line is required!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM