我目前正在尝试使用 travis、heroku 和 coveralls sbt 插件设置一个 play scala 项目构建链以进行代码覆盖。我用激活器创建了一个干净的 scala play 应用程序,并添加了工作服插件和一个 travis.yml。
当我推送我的项目并触发构建时,我在 travis 运行测试时得到以下异常:
[error] c.g.h.h.HtmlPage - Error loading JavaScript from [http://localhost:19001/assets/javascripts/hello.js].
java.io.IOException: Unable to download JavaScript from 'http://localhost:19001/assets/javascripts/hello.js' (status 404).
at com.gargoylesoftware.htmlunit.html.HtmlPage.loadJavaScriptFromUrl(HtmlPage.java:1106) ~[htmlunit-2.13.jar:2.13]
at com.gargoylesoftware.htmlunit.html.HtmlPage.loadExternalJavaScriptFile(HtmlPage.java:1039) ~[htmlunit-2.13.jar:2.13]
at com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:409) [htmlunit-2.13.jar:2.13]
at com.gargoylesoftware.htmlunit.html.HtmlScript$3.execute(HtmlScript.java:266) [htmlunit-2.13.jar:2.13]
at com.gargoylesoftware.htmlunit.html.HtmlScript.onAllChildrenAddedToPage(HtmlScript.java:286) [htmlunit-2.13.jar:2.13]
我发现这个旧主题(https://groups.google.com/forum/#!topic/play-framework/yj4NT3BO0Os)具有相同的错误消息,但不幸的是,那里的解决方案都不适合我。
这里有没有人使用工作服或知道我的问题的解决方案?我已经附上了所有的配置文件。
构建.sbt
import scoverage.ScoverageSbtPlugin.instrumentSettings
import org.scoverage.coveralls.CoverallsPlugin.coverallsSettings
name := """buildchain"""
version := "1.0-SNAPSHOT"
scalaVersion := "2.11.1"
lazy val root = (project in file(".")).enablePlugins(PlayScala)
libraryDependencies ++= Seq(
jdbc,
anorm,
cache,
ws
)
instrumentSettings
CoverallsPlugin.coverallsSettings
ScoverageKeys.minimumCoverage := 1
ScoverageKeys.failOnMinimumCoverage := true
插件.sbt:
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
resolvers += Classpaths.sbtPluginReleases
// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.5")
// web plugins
addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.0.0")
// code coverage
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "0.99.7.1")
addSbtPlugin("org.scoverage" %% "sbt-coveralls" % "0.99.0")
travis.yml
language: scala
scala:
- 2.11.2
script: "sbt coveralls"
notifications:
email: false