Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuration files not in Play Framework 2.0 classpath when calculating code coverage using SCCT

I configured the Play Framework 2.0 to use SCCT for coverage, and can run scct using play scct:cover.

However, my tests are unable to read any configuration files, because the configuration files are not in the classpath. To wit, I am using the typesafe ConfigFactory to load the configuration files, and I receive the following error: com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'KEY.NAME'

play test and play run work perfectly well.

Is there some way I can force Play's Build.scala to add the conf/ directory to the classpath?

The relevant portion of my plugins.sbt file looks like this: resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

resolvers += Classpaths.typesafeResolver

resolvers += "scct-github-repository" at "http://mtkopone.github.com/scct/maven-repo"

addSbtPlugin("reaktor" % "sbt-scct" % "0.2-SNAPSHOT")

addSbtPlugin("play" % "sbt-plugin" % "2.0.4")

The relevant portion of my Build.scala looks like this: lazy val additionalSettings = Defaults.defaultSettings ++ seq(ScctPlugin.instrumentSettings: _*)

val main = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA, settings = additionalSettings).settings(
    testOptions in Test := Nil,
    parallelExecution in test := false
)

Thanks!

like image 586
Siddhu Avatar asked Dec 28 '25 14:12

Siddhu


1 Answers

This is probably not specific to Play. The scct plugin should probably include the resources in the Test configuration in the ScctTest configuration like it does for other classpath elements. You can do it yourself explicitly by adding the conf directory to the list of unmanaged resource directories for scct:

unmanagedResourceDirectories in ScctPlugin.ScctTest <+= baseDirectory( _ / "conf")
like image 143
Mark Harrah Avatar answered Jan 01 '26 21:01

Mark Harrah